Recently, the effect of Windows Vista glass has been imitated by peers in the world. The younger brother is not talented. He also posted his own remark.
First, prepare two background images. One is a normal image, and the other is a blur of the normal image.
Use the background definition in CSS to set the normal image as the background of the body node (note that the margin of the body must be set to 0, otherwise the blurred image and the normal image will have a location offset ), set the property of background-attachment to fixed.
Next, set the style on the image that needs to apply the frosted glass effect, and set the blurred image as the background of the required node, similarly, set the attribute of background-attachment to fixed (the location of the required node is preferably absolute ).
In this way, the effect of imitating Windows Vista is basically complete.
-------------------------------------
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML xmlns ="
Http://www.w3.org/1999/xhtml>
<Head>
<Style type = "text/CSS">
*{
Margin: 0px;
Padding: 0px;
}
Body {
Background-image: URL (./back.jpg );
Background-Attachment: fixed;
}
Div. Glass {
Background-image: URL (./glass.jpg );
Background-Attachment: fixed;
Position: absolute;
Top: 100px;
Left: 200px;
Width: 300px;
Height: 200px;
Overflow: hidden;
}
</Style>
</Head>
<Body>
<Div class = "Glass"> </div>
<Div style = "width: 3000px; Height: 3000px;"> </div>
</Body>
</Html>
-------------------------------------
PS: for the time being, ie6is not supported. If you want to use back.jpg as the original background, glass.jpg uses the original background PS as the frosted glass. The size is the same as that of the original image.