Napіvprozora CSS fill. CSS visibility - cross-browser solution

Antipyretic remedies for children are prescribed by a pediatrician. But there are situations of indispensable help in case of care, if the child needs to give faces negligently. Then the fathers take on themselves the resuscitation and stop the antipyretic preparations. What can be given to infants? How can you lower the temperature in older children? What are the most safe faces?

The transparency of the background image (accepted for 2016) cannot be installed directly through CSS (including CSS 3). Є impersonal workarounds to solve the problem.

Zmіshuvannya fonіv

Himself forgive decisionsє zmіshuvannya dvoh fonіv (image that napіvprozora color). Tsey sposіb pіdіyde yakscho pіd "let's see through the image background" the same type of background because it’s not the transparency of the picture, but її іmіtatsija for rahunok zmіshuvannya image with color. Install the underlying background that is formed from the background image and the desired color with the alpha channel. Then choose the most suitable mode of mixing and adjusting the composition with the alpha channel to the required result.

Background: url("/images/img1.jpg"), rgba(255,255,255,0.9); background-blend-mode: color;

Adding a pseudo element

The best way to reach the bagan. We create a pseudo-element behind the after pseudo-class. Є

position: absolute; before (otherwise) #main and at the same height as #main, then stop background-image and opacity: 0.2; .

#main ( position: relative; ) #main:after ( content: ""; display: block; position: absolute; top: 0; left: 0; background-image: url(/wp-content/uploads/2010/11 /tandem.jpg), width: 100%; height: 100%; opacity: 0.2; z-index: -1;

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

In every level of the world we can see CSS transparency, we know how to give different elements of the side visibility and access to full cross-browser compatibility, so that the same robotic effect in different browsers.

How to set the transparency of any element

CSS3 has the power of opacity for creating transparent elements, so you can zastosovuvat to any elements. The value of authority is from 0 to 1, which signifies the degree of transparency. De 0 - tse povna lucidity (value for abbreviations for all elements), and 1 povna opacity. The values ​​are written in fractions: 0.1, 0.2, 0.3 just.

Vikoristan example:

transparency

Cross-browser transparency

Not all browsers accept the same implementation of the higher opacity power. In some cases, it is necessary to win another name for power, or filter.

Power CSS3 opacity Mozilla browser 1.7+, Firefox 0.9+, Safari 1.2+, Opera 9+.

So good :) browser yak Internet Explorer up to version 9.0 does not take into account the power of opacity and transparency for which browser it is necessary to change the power of the filter and the alpha(Opacity=X) value, for which X - the whole number in the range of 0 to 100 for the help of which the transparency value is assigned. 0 is full transparency, and 100 is full opacity.

What is the cost Firefox browser up to version 3.5 win power -moz-opacity replace opacity.

Such browsers, like Safari 1.1 and Konqueror 3.1, inspired by the KHTML engine, use the transparency opacity for scanning: -khtml-opacity.

How do you set CSS transparency so that it looks the same in all browsers? To create a cross-browser solution for the transparency of elements, it is necessary to prescribe not only one power opacity, but the next set of powers:

filter: alpha (Opacity = 50); /* Opacity for IE */ -moz-opacity: 0.5; /* Mozilla 3.5 thumbnail and below */ -khtml-opacity: 0.5; /* Konqueror 3.1 and Safari 1.1 trim */ opacity: 0.5; /* Help to solve browsers */

Transparency of various elements

Let's look at the deyak, apply the task of transparency to the singing elements, as the most victorious sides.

CSS image transparency.

Let's take a look at a few options for creating a transparent picture. The attacking butt of the first picture does not have a transparency, the other can have a transparency of 50%, the third 30%.

transparency

Result:

Clearance on CSS for an hour of hovering the cursor over the image.

Often we need to look at the picture, otherwise there may be some other element at that moment, if the cursor is hovered over it. You can also help with the CSS pseudo-class: hover. For which of our pictures it is necessary to prescribe two classes, one is superb - if the picture is inactive and the other class is pseudo-class: hover, here it is necessary to indicate the transparency of the picture at the time of hovering over the cursor.

transparency

You can see the result in the demo.

Clear background with CSS.

Here it is necessary to remember that the transparency is expanding on all the contributions of the elements and the stink cannot be greater transparency of the lower contributions of the element.

Like a butt, we’ll create an option with a side background for an additional picture and a block with a background for an additional color and transparency of 50%.

Example code:

transparency

Text

Axis is the result of the placed code:

Vlad Merzhevich

Chastkova transparency with the correct її vikoristannі even effectively looking at the design of the site. Golovnya, that under the napіvprozorimi blocks, it’s not a monotonous little baby, but an image, in the same way, the transparency becomes commemorative. Such an effect can be different ways And as if to guess everything, including old-fashioned methods, it's like a rotten thing, a creation of a mapped image and the power of opacity. And just as a little blame for the need to work in the block, it’s as if it’s rotten, these methods have an unacceptable reverse side. Zrobl little glance So it became clear, about how to go, and also for quiet readers, who do not know about non-traditional options for creating the effect of transparency.

yak background png

At graphic editor in the front, one-colored baby is prepared for the first time, which is taken from the PNG-24 format (Fig. 1). The peculiarity of this format is the support of 256 equal transparency, or simply seeming, in vmіє vіdobrazati napіvprozorі pictures.

Mal. 1. Image to match the background

Because of what we give the little ones like ashes through the power of the background, as shown in the appendix 1.

Butt 1

XHTML 1.0 CSS 2.1 IE Cr Op Sa Fx

Clarity at the ball

The result of this butt is shown in fig. 3.

Mal. 2. Zastosuvannya background baby

The old browser Internet Explorer 6 does not work with transparency in PNG-24, so for whatever reason it is necessary to upgrade this browser, I might have to tweak the scripts.

Guidance method may be low. So, when images are enabled in the browser, the background will show up. Until then, it is not so easy to change the color of the ashes and the meaning of transparency, for which it is possible to re-edit the image.

Key image

This method goes back to the ancient methods of implementing transparency, if the browsers “didn’t do anything”, and there were some unconventional solutions. The focus is on the folded image, in which gaps and opaque pixels are drawn (Fig. 3). Such a regular structure creates the effect of transparency, actually imitating it.

Mal. 3. Bigger kartatiy babies

The axis looks like a clear eye (Fig. 4).

Mal. 4. Imitation of the drink transparency

The shortcomings of this method can be compared with the previous one, as well as the moiré winding and text correction.

Power opacity

The power of CSS 3 opacity determines the transparency value and varies from 0 to 1, zero is the element's transparency, and 1, on the other hand, is opacity. The power of opacity has a peculiarity - the transparency expands despite all the daughter elements, and the stench can outweigh the meaning of the transparency of your father. It is impossible to walk out that an impenetrable text on a transparent background (appendix 2).

Butt 2. Vikoristannya opacity

XHTML 1.0 CSS 2.1 CSS 3 IE Cr Op Sa Fx

Clarity at the ball

The magnetic field, which was far away to establish behind the nature of the spectrum, sees a cosmic meteorite, falling all day for twenty sixth the number of the month of Karney, which the Athenians call metahythnion.

The result of the butt is shown in Fig. 5.

Mal. 5. Add clarity to text and background

In Internet Explorer up to version 8.0 inclusive, opacity does not work, so the filter power is specific to that browser. Obviously, it's okay to generate invalid CSS code.

RGBA

The modern idiom is much simpler and more advanced than the scientific methods and uses the best for colors and backgrounds in RGBA format. The first three letters are known in richness and are deciphered as red, green, blue (black, green, blue), the rest symbolizes the alpha channel and sets the transparency of the element. The record format is this.

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

At the arms, instead of letters, the value of the color component is placed, which can be marveled at in any graphic editor, the rest of the value is set to transparency and increases from the value of the power of opacity.

Not all browsers support this format: Internet Explorer starting from version 9, Opera from version 10, Firefox from 3, Safari from 3.2. In a nutshell, modern browsers correctly display clarity. For older versions of IE, you can easily specify the color for the primary one for the new format, and, obviously, there will be no transparency. Otherwise, I will reconcile with the power of the filter, or else I will be able to reconcile, so that the transparency will also hit the text (app 3). In order to get to the valid CSS code, I'm going to use smart comments.

Butt 3. RGBA variant

HTML5 CSS3 IE Cr Op Sa Fx

Nap_vprozor tlo

Veletensky Zoryan spiral with a diameter of 50 kpc, far away to set the nature of the spectrum, miraculously illustrating meteor showers, Prote Don Emans included in the list of all 82 Great Comets.

The result of the butt can be shown in fig. 6.

Mal. 6. Napіvprozora rot with opaque text

Adjust the picture from the front, the letters have become brighter and clearer.

At Internet browser Explorer 7 had a bug when changing background-color from different values. For example, if you set the background color of the chervonim, as shown below, then the background in IE7 will not be displayed.

Div (background-color: red; /* Not stuttering in IE7 */ background-color: rgba(255, 0, 0, 0.5); )

Changed by changing the quality of background-color to background.

Div (background: red; /* But it doesn't work */ background: rgba(255, 0, 0, 0.5); ) There's a caveat though. The CSS validator "bars" on the background to give it a value for the RGBA format. Ale, with whom, it is correct to put it before background-color. Zagalom, as a rule, it is necessary to collect that validity between browsers.

Description

Sets the color of the element to the background. If you want your power not to decline in the power of your father through those that are gradually being established, we will see the color of the background of the daughter elements to match the color of the background of the father's element.

Syntax

background color:<цвет>| transparent | inherit

Value

transparent to set the gap to tlo. inherit The last meaning of the father.

HTML5 CSS2.1 IE Cr Op Sa Fx

background color

Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.

At this butt for the elements of the web page, three different ways setting the background color. The result of the butt is shown in Fig. one.

Mal. 1. Tweaking background-color

Object Model

document.getElementById("elementID ").style.backgroundColor

browsers

Internet Explorer up to and including version 7.0 does not support the inherit value.

You can often find it on the Internet to download images, for example, to embed yoga on a website. And maybe, you make a collage and you need to add more for one little one. The axis of the image only needs to sound to paint the background.

Let's figure it out, how can we open the gap for the image for the help of the editorAdobephotoshop. I have the English version installed Adobe Photoshop CS5, I'll show it to you on a new one.

I'll try to direct different days hot keys.

Even if you don’t have photoshop installed yet, it’s rare to see it, but it’s English mine, you can open it up in Paint.net. This is a simple Russian image editor, like a loan of a troch of space on a hard disk. Switching to the power, you can read the report article. You can download the Paint.net program from our website.

On the back of the hand, a simple butt is looked at. Suppose you have an image on a monochromatic aphid, or you can have a logo or name it. Zrobimo chi logo was written on a transparent background in photoshop.

Please note that the editor needs an image. Now the gap is open for the ball. At the “Shari” window, we click twice with a bear on the given ball - on the contrary, there is a padlock. Vіdkryєtsya vikno "New ball", press in the new "OK". After that, the lock is known.

Select the "Charm wand" tool. For a row of authorities, indicate the level of sensitivity, set different values, in order to understand, like a wine, for example, 20 and 100. To take a vision of a little one, press Ctrl + D.

We set the sensitivity that is pressed with a enchanting wand on the area of ​​​​the background. To add to the visible background, those parts that were not seen, press Shift and continue the vision. To delete the visible area, press "Delete".

Now replace the background of the checker's board - it means that we have fared to work and see the white background. We can see it - "Ctrl + D".

Like you have an image or a photograph, on a rich variety of colors and objects, it’s clear, like a clear vision of the body for the image in photoshop.

At this moment we speed up with the tool “Shvidke Vision”. Click on the charm finger with the left button of the mouse with a small zatrimka and select it from the required tool menu.

Now it is necessary to see the object, which you want to deprive on the transparent aphids. Install in a row of authorities rіznі razmiri and click on the object, adding to the new area. It’s as if it’s easy to see uncommonly rotten, press “Alt” and take yoga away.

To review the result, press "Q". We will see the parts of the image with faces, as if they will become insightful.

Copy the view of the area by pressing Ctrl+C. Let's create new file, Ctrl+N, let's see through the background.

Paste in the new copied fragments, "Ctrl + V". As if they were left with uncommon parts of the background, take them away for the help of the “Eraser” tool. It is preferable to expand on a transparent aphid images in PNG or GIF format.

To work white as a wreck the little one is clear, but to work a gap as the body is for a few fragments of a color image and a photograph in Photoshop. If you can win them there, where it is necessary: ​​insert them on the site, add them to the other little ones or work on the collages.

Clear Background CSS

The transparency of the background on the site is created through your CSS. Transparency can be achieved in two ways: through the power of opacity and background:rgba(). Let's take a look at the skin of them, and then we'll make a comparison.

1. The power of CSS opacity to make the background transparent

CSS has the power of opacity, for the help of which you can set the clarity of images, texts, including backgrounds.

The task of transparency is set simply by entering a speech number from 0.0 to 1.0. The smaller the number, the smaller the object will be.

opacity: 0.5 //Paper transparencyopacity: 0.2; // Object less visible by 20% opacity: 0.8; // The object is less than 80% visible

Let's take a look at the butt of power opacity.

The text is also clear

2. Visibility Through Power CSS background: rgba()

Another option to set the transparency of the background on the site is the power of CSS background: rgba. We look at the butt

The text is also clear

This code turns to the side on the foot:

The difference between two ways is determined by the fact that the text in the middle of the block becomes visible at different opacity.

The other person has no such problem. That's why it's necessary to marvel at any situation - what specifically you check.

Support the project - share your efforts, darling!
Read also
How to install avast free antivirus How to install avast free antivirus How to clean the computer'ютер від вірусів самостійно How to clean your computer from viruses on your own How to clean up the computer again'ютер від вірусів How to clear the computer again from viruses