There are three ways to change the transparency of an element in CSS:
using the opacity property,
using the rgba() function,
using the hsla() function.

1. Opacity property

The opacity property allows you to make any element of a web page partially or completely transparent. This property changes the transparency of elements for which background image(picture) or the background is set using a color or gradient. If an element that has the opacity property applied contains other elements within it, they will also change their transparency.
The opacity property accepts values ​​ranging from 0 (fully transparent) to 1 (opaque), for example:

H1 (color: #CD6829;) div ( background: #CDD6DB; opacity: .3; )
Rice. 1. Transparency of elements using opacity

2. rgba() function

The RGBA color model creates a color tone by mixing red (Red), green (Green) and blue (Blue) colors in the required proportions, and the alpha channel (Alpha) is responsible for the degree of transparency of the color. Unlike the opacity property, for a block containing other elements, the rgba() function will change the opacity of only the block.

Rice. 2. RGB color model h1 (color: #CD6829;) div (background: rgba(205, 214, 219, 0.3);)
Rice. 3. Transparency of elements using the rgba() function 3. hsla() function

The hsla() function, whose parameters are Hue, Saturation, Lightness and Alpha, also allows you to set a semi-transparent color.

Color shades are specified as percentages using corresponding value from the color wheel. The circle itself is divided into sectors, on the boundaries of which there are primary colors:

0/360° - red
60° - yellow
120° - green color
180° - blue color
240° - blue color
270° - purple color
300° - purple color.

To get black, you need to set the hue, saturation, and brightness values ​​to zero - hsla(0, 0%, 0%, 1) . White is produced at 100% brightness hsla(0, 0%, 100%, 1) and gray is produced at zero saturation hsla(0, 0%, 50%, 1) .

orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using "Content here, content here", making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for "lorem ipsum" will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humor and the like).

So, today we will talk about transparency in html pages. You've probably come across transparent pop-up blocks, be it a photo gallery or login forms on some popular website. There are many uses for transparency in HTML. So how is it made and where can it be used?

Well, first of all, let’s understand that our document has not only one monitor plane - it is generally 3-dimensional, I mentioned this in the article “Z-index”. Accordingly, even a completely transparent layer, if it were at the top of the display stack, would block access to other elements. This is one of the main uses of transparent blocks. Although a shading effect is usually used, a completely transparent layer will work exactly the same. So, for example, a lot of popular photo galleries work; a shaded layer is organized in which photos and controls for them are displayed. The rest of the page is “covered” with a (semi) transparent layer, blocking access to all other elements on the page. Those. You will not be able to leave the page by clicking any link on it - all the text is covered with a background. To return to the body of the site, they usually provide controls for closing the gallery, login form, etc. Control showing/hiding transparent blocks with using javascript. Unfortunately, there is no alternative to it. Without using it, the user will either not see the transparent block at all, or will not be able to close it without leaving the current page. I note that visibility or display properties are used for this.

So how is transparency actually organized in html? Setting element transparency is generally not included in the CSS specification, so you have to use several instructions at once to create it. Some browsers (ie) will work with one option, others with another. Ie uses the built-in filter functionality, other browsers use the "opacity" property, which is set in the range from 0 (completely transparent object) to 1 (completely opaque). For example, in the case of 30% transparency, you should write "opacity:0.30; filter:alpha(opacity=30); ". The properties, as can be seen from the example, are similar - only in the first case a number from 0 to 1 is used, in the second a percentage notation is used. An example of such a block: