Prosperity ball css. CSS insight - cross-browser solution

Creating a clear background in HTML and CSS (opacity and RGBA effects)

The effect of insight the element is well marked on the background and the appearance of expansion in different operating systems something that looks stylish and beautiful. The head of the mother under the lucid blocks is not a monochromatic baby, but an image, in which the lucidity itself becomes noticeable.

This effect can be achieved in different ways, including old-fashioned methods, like the vikoristan baby PNG like a solid, the creation of a mapped image and the power of opacity. It's really important to work in the blog napivprozor tlo These methods have some unpleasant downsides.

Let’s take a look at the contrast between the text and the background – how to correctly use it in website design:

The main feature of this power lies in the fact that the importance of insight applies to all subsidiary elements in the middle, and not just to aphids. This means that the background and text will become visually striking. You can increase visibility by changing the opacity command from 0.1 to 1.

HTML 5 CSS 3 IE 9 opacity

Creation and promotion of sites on the Internet

In web design, partial insight also stagnates and reaches beyond the format colori RGBA, which is specified only for the background element.

Make sure that the design is transparent without a solid element, and the text is opaque to preserve its readability. The power of opacity does not fit here, since the text in the middle of the element will also often be clear. The most beautiful vikoristovati RGBA format Part of this is the alpha channel, or in other words, the meaning of insight. As the meaning is written rgba, then at the arms through whom the meanings of the red, blue and green components of the color scheme are determined. The remaining clarity is set from 0 to 1, which means 0 is clear, and 1 is not clear to the color - the syntax is rgba.

Napivprozor tlo HTML 5 CSS 3 IE 9 rgba

Creation and promotion of sites on the Internet.
The obscurity value for the background is set to 90% - a clear background and an obscure text.

The power of CSS opacity refers to the visibility of elements (images, text, blocks) in HTML.

CSS opacity syntax

opacity: value;

The value can generate speech values ​​in the range from 0.0 to 1.0. A value of 1.0 means that the visibility is daily (behind the day).

Apply: how insightful html is

Example #1. View of the image in html

The first picture was displayed without clarity, the other with clarity 0.5

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

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

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

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

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

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

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

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

object.style.opacity ="VALUE "

Для создания эффекта прозрачности в CSS используется свойство opacity .

Браузер IE8 и более ранние его версии поддерживают альтернативное свойство - filter:alpha(opacity=x) , где " x " может принимать значение от 0 до 100 , чем меньше значение, тем прозрачнее будет элемент.

Все остальные браузеры поддерживают стандартное CSS свойство opacity , которое может принимать в качестве значения числа от 0.0 до 1.0 , чем меньше значение, тем прозрачнее будет элемент:

Название документа Try it »

Vision when hovering

Pseudo-class:hover allows changing external look elements when they hover over the mouse cursor. We quickly hope that the image, when hovered over the mouse, loses its insight:

Document name Try it »

Serenity to the background

Є two possible ways To create an element we can see: the power of opacity is described above, and the addition of color to the background in the RGBA format.

You may already be familiar with the color model in the RGB format. RGB (Red, Green, Blue - red, green, blue) - color system, which means a shade of mixing red, green and blue colors. For example, to create a yellow color for the text, you can speed up any of the upcoming announcements:

Color: rgb(255,255,0); color: rgb(100%,100%,0);

The colors specified for the additional RGB are raised to the hexadecimal values ​​that we used earlier, which allow us to select the alpha channel of visibility. This means that through the background of the element with alpha clarity it will be visible what is underneath it.

The RGBA color scheme is similar in syntax to the standard RGB rules. However, in addition, we will need to specify the value as RGBA (replacement of RGB) and set an additional tenth value of transparency after color value in the range from 0.0 (more transparency) to 1 (more darkness).

Color: rgba(255,255,0,0.5); color: rgba(100%,100%,0,0.5);

The difference between power opacity and RGBA lies in the fact that power opacity stagnates insight into every element as a whole, so that the entire element becomes insightful. And RGBA allows you to set clarity to the edged parts of the element (for example, just text or background):

Body ( background-image: url(img.jpg); ) .prim1 ( width: 400px; margin: 30px 50px; background-color: #ffffff; border: 1px solid black; font-weight: bold; opacity: 0.5; filter : alpha (opacity = 70); / * for IE8 and earlier versions * / text-align: center; font-weight: bold;

Note: RGBA values ​​are not supported in IE8 and later browsers earlier versions. To provide a color fallback option for older browsers that do not support color values ​​with alpha channels, set the first RGBA value: background: rgb(255,255,0); background: rgba(255,255,0,0.5);

Description

This indicates the level of clarity of the web site. With partial or greater clarity, a background detail or other elements appear through the element, positioned lower than the visible object.

Syntax

opacity: value

Significance

The value is determined by the number in the range. Values ​​0 indicate increased clarity of the element, and 1, on the other hand, indicate its lack of clarity. Fractional numbers of the form 0.6 establish clarity. It is allowed to write numbers without a leading zero, like opacity: .6.

HTML5 CSS2.1 CSS3 IE Cr Op Sa Fx

opacity

Result given the butt shown in Fig. 1.

Small 1. Result of vikoristanny opacity

Browser

Firefox up to version 3.5 supports non-standard power -moz-opacity.

Internet Explorer up to version 9.0 to change the visibility of the vikoryst filter, for which browser write filter: alpha(opacity=50), where the opacity parameter can be filled with values ​​from 0 to 100.

CSS insight - cross-browser solution - 3.8 out of 5 based on 6 votes

In this lesson we will look at CSS clarity, we will learn how to give various elements of the page clarity and achieve full cross-browser compatibility, so that the same effect will work in different browsers.

How to set the insight of any element

In CSS3, the creation of clear elements is based on the power of opacity, which can be limited to any elements. This power has values ​​from 0 to 1, which indicate the level of insight. Where 0 is the total insight (values ​​for the calculations for all elements), and 1 is the total lack of insight. The values ​​are written as fractions: 0.1, 0.2, 0.3 etc.

Vikoristan butt:

Serendipity

Cross-browser visibility

Not all browsers, however, accept and implement the higher power of opacity. In such situations, it is necessary to use something called power or filter.

The power of CSS3 opacity encourages such types Mozilla browsers 1.7+, Firefox 0.9+, Safari 1.2+, Opera 9+.

So good:) a browser like Internet Explorer, even up to version 9.0, does not support the power of opacity and for clear visibility, this browser needs to use the power of filter and alpha (Opacity=X), in which X is a whole number in the range from 0 to 1 00 , for whose assistance there is a zeal of insight. 0 is completely insightful, and 100 is completely unclear.

What's the fuss? Firefox browser Until version 3.5, it supports power -moz-opacity instead of opacity.

Browsers such as Safari 1.1 and Konqueror 3.1, based on the KHTML engine, use the following browser visibility option: -khtml-opacity.

How can we make CSS transparent so that it looks the same in all browsers? To create a cross-browser solution for the visibility of elements, it is necessary to register not only one opacity power, but an additional set of powers:

filter: alpha (Opacity = 50); /* Visibility for IE */ -moz-opacity: 0.5; /* Mozilla 3.5 support and lower */ -khtml-opacity: 0.5; /* Support for Konqueror 3.1 and Safari 1.1 */ opacity: 0.5; /* Browser support */

The clarity of various elements

Let's take a look at the applications of insight into the song elements, which are the most frequently used pages.

CSS clarity of the image.

Let's take a look at a number of options based on the visual picture. The first picture has no clarity set, the other one has a clarity of 50%, and the third has 30%.

Serendipity

Result:

Insight into CSS under the hour of hovering the cursor over the image.

It is often necessary to create a clear picture or some other element at that moment when the cursor is hovered over it. Payment can be made for CSS help pseudo-class: hover. For this picture it is necessary to register two classes, one primary - the inactive state of the picture and the other class with the pseudo-class: hover, here it is necessary to indicate the visibility of the picture at the moment of hovering the cursor.

Serendipity

You can see the result in the demo.

Background clarity in CSS.

Here it is necessary to remember that insight expands to all inputs of an element and it is impossible to expand greater insight beyond the inputs of an element.

As an example, let’s create an option with the background of the side created by an additional picture and the block with the background created by an additional color and a clarity of 50%.

Butt code:

Serendipity

Text

The axis is the result of the posted code: