Insight into css. The power of CSS opacity: managing transparency

Zharoznizhyuchі zasobi for children is recognized as a pediatrician. Allegedly, there are situations of inconspicuous help in case of fever, if the child is in need of giving it innocently. Todi dad take on the versatility and consistency of fever-lowering drugs. Is it allowed to give children a breast vіka? How can you beat the temperature of older children? What are the best ones?

There are three ways in CSS to change the visibility of an element:
for the help of power opacity,
for the additional function rgba (),
for the additional function hsla ().

1. Power opacity

The power of opacity allows you to create a web-side element, or we will see through it. The power of change is given to the foresight of the elements, for which the background of the image (picture) is set, for tasks, background for an additional color or gradation. As an element, for those who are stuck with the power of opacity, to take revenge in their own elements, then the stench can also change its vision.
The power of opacity is accepted in the range from 0 (increase in foresight) to 1 (non-confusion), for example:

H1 (color: # CD6829;) div (background: # CDD6DB; opacity: .3;)
Small. 1. The transparency of the elements behind the additional opacity

2. Function rgba ()

Column RGBA model of the sash collar of the path of change in the necessary proportions chervony (Red), green (Green)і blue koloriv, ​​and alpha channel (Alpha) for the steps of the color. On the basis of the power of the opacity, for the block to take revenge on the elements, the rgba () function to change the vision of the block only.

Small. 2. Color model RGB h1 (color: # CD6829;) div (background: rgba (205, 214, 219, 0.3);)
Small. 3. The visibility of the elements behind the additional function rgba ()

3. Function hsla ()

Function hsla (), parameters mean tone (Hue), saturation, Lightnessі alpha channel (Alpha), It is also allowed to set napivprosory colir.

Vidtinka koloru are posed in a variety of cola, vikoristovuyu and vіdpovidne value from cola cola. The very colo rozbitiy on the sector, on the cordons where the main colors are located:

0/360 ° - red color
60 ° - zhovty colir
120 ° - green color
180 ° - black color
240 ° - blue color
270 ° - violet color
300 ° - purple color.

Schob remove the black color, it is necessary to use indicators of tone, weight and density of zero value - hsla (0, 0%, 0%, 1). Bilium color should be used at 100% value of hsla (0, 0%, 100%, 1), and Syry color - at zero value of hsla (0, 0%, 50%, 1).

Chіііііx!

After thinking about it, why don't you write me about the power of transparency for the 3rd CSS? So, at once to fly a bunch of replicas in my direction, I know everything about the power! Ha, dumb! Mementos, far from everything.

At the present moment it is great the last version modern browsers already add CSS 3 ( !!! Navigate IE 9 !!!). So, you can still experience power in the code of your side.

And so, turning to power " opacity", Yake yes tsіkaviy efect, without drawing graphics, all-in-all, registering 1 row of code.

So also "opacity" in CSS 3?

"opacity"Make the insight of any element on the web site. So, having asked the singing level of vision, we can hit the background little ones, or the other element, which would be tweaked with an element that was set for vision. So, why not?

I have in bloos є a set of elements, for which the price of power is spelled out. You can kick a live butt, if you go down to the bottom of the sidebar, there є friends". Little dark, right? And now hover the bear's cursor on the new one. Having become more readable, why is it wrong?)

Infected reports, as they have been implemented for me.

We will need to ask the insight for the element for the contributions. Tobto, the element will be watched by the trocha of darkness. I set the opacity to 70%. So, as all browsers understand the code in a simple way, we need to write a universal code.

for Firefox,Opera,Chrome written:

Opacity: X;

de " X"- value in the range of 0.0 1.0 (Opacity of the element).

for Internet Explorer (Pidtrimu 8 and 9 versions):

Filter: alpha (opacity = X);

de " X"- value in the range of 0 (Increased penetration of the element) up to 100 (Opacity of the element).

Myimage (opacity: 0.7; filter: alpha (opacity = 70);)

And now we can set the rules for the element, if the mouse cursor is hovering on the new one. We need to read the image of the element, and for that I put 100% opacity, so that the element of the view is like this, for good reason:

Myimage: hover (opacity: 1.0; filter: alpha (opacity = 100);)

Axle a couple of butts:

the vision of photography100 (1.0), Tobto is dumb


the vision of photography70 (0.7)... Rіznokolorovі cola - tse "break through" the picture, yaka roztashovana on tlі, tobto for the photograph

power of CSS opacity is based on the clarity of elements (pictures, text, blocks) in html.

CSS opacity syntax

opacity: value;

De value can be accepted in the range from 0.0 to 1.0. A value of 1.0 - means that the vision of the day (for the change).

Apply: yak insight in html

Butt number 1. View images in html

The first picture is viveden without vision, a friend with vision 0.5

Пример №2. Эффекты с прозрачностью в html

По умолчанию блок частично прозрачный. При наведении курсора мыши блок становится ярким. Такие эффекты зачастую используются в дизайне сайтов.

На странице преобразуется в следующее

Пример №3. Прозрачный блок на изображении в html

Ниже приведен пример полупрозрачного блока, который частично закрыл изображение. Блок специально накрывает изображение не полностью с целью показать, как он выглядит на пустом фоне.

На странице преобразуется в следующее

Примечание
Internet Explorer до версии 9.0 для изменения прозрачности использует фильтры, для этого браузера следует записать filter: alpha(opacity=50), где параметр opacity может принимать значение от 0 до 100.

Для обращения к opacity из JavaScript нужно писать следующую конструкцию:

object.style.opacity ="VALUE "

Описание

Определяет уровень прозрачности элемента веб-страницы. При частичной или полной прозрачности через элемент проступает фоновый рисунок или другие элементы, расположенные ниже полупрозрачного объекта.

Синтаксис

opacity: значение

Значения

В качестве значения выступает число из диапазона . Значение 0 соответствует полной прозрачности элемента, а 1, наоборот — его непрозрачности. Дробные числа вида 0.6 устанавливают полупрозрачность. Допускается писать числа без нуля впереди, вида opacity: .6 .

HTML5 CSS2.1 CSS3 IE Cr Op Sa Fx

opacity

result given the butt indications in fig. 1.

Small. 1. Result of vikorystannya opacity

browsers

Firefox prior to version 3.5 has a non-standard -moz-opacity option.

Internet Explorer up to version 9.0 for changing the visibility of the vicious filter, for the whole browser go to filter: alpha (opacity = 50), or the opacity parameter can be taken from 0 to 100.

Inodi vinik need for development foresight background for the singing block on the side. You can ask for a tsiy efect on the leaves of the transparent background malunka in the format * .pngі having risen yogo through power background: url ("./ images / fon.png");.

Vikorist power OPACITY

Nowadays such folding, as well as the price can be made from in addition to CSS... Let's dissolve the main block on the side ( page) I investment block ( block), Yaku possesses insight. Cross-Browserness is Reached by the Offensive Rank: Power for Internet Explorer - filter: alpha (opacity = 50) (Clearance values ​​in the range from 0 to 100), For browsers with the CSS3 standard - opacity: 0.5 (number in the range from 0.0 to 1.0).

HTML code:

napprozoriy element

Prospect background for the block.

result:

Prosory background for the block

Yak Vee was remembered, insight is extended to all daughter elements

Prosory background for the block

v DIV s class block and the stench cannot overwhelm the meaning of one's father's vision. Tobto, we will see through everything in this bloc. What robiti, how about the need to overshadow the diva's von tilka's insights?

Vikorist's power BACKGROUND-COLOR

We need to add some changes to the CSS style sheet, and change it for the block. DIV s class block power opacity on power background-color.

Div.block (width: 260px; height: 140px; margin-top: 79px; margin-left: 94px; border: 1px solid # 333333; / * glimpse background only DIV.block * / background-color: rgba (255, 255 , 255, 0.5); / * Color background, transparency 0.5 * /)

result:

Prosory background for the block

At the sight of a pointed butt, vikoristovuyutsya for color and background RGBA format ... De, pershі three letters are deciphered yak red, green, blue (chervonia, greenery, blue), Remaining symbolized by yourself alpha channel (a) I set insightь element from 0.0 before 1.0 .

Background-color: rgba (r, g, b, a);

At the arches, the letters are replaced by the value of the component of the color, you can marvel at whatever graphic editor, for example Paint.Net(Screenshot). Remaining value a I will establish discernment and stand up for the meaning of power opacity.

http://cp77.comxa.com/verstka/css-transparent-fon

Feel free to accept the project - please, thank you!
Read also
Sberbank (as well as Oschadbank) Sberbank (as well as Oschadbank) Solution of license problems for Autocad Chi does not start autocad windows 7 Solution of license problems for Autocad Chi does not start autocad windows 7 Instructions for registering the PIN code of the CryptoPro, before the hour of signing up some documents - Instructions - AT Instructions for registering the PIN code of the CryptoPro, before the hour of signing up some documents - Instructions - AT "PEK-Torg"