Compatible with PNG transparent CSS definitions in various browsers, and pngcss definitions in browsers

Source: Internet
Author: User

Compatible with PNG transparent CSS definitions in various browsers, and pngcss definitions in browsers

<Style>
. Mycls {
Width: 48px;
Height: 48px;
Background: url(20090318230119136.png) no-repeat left top;
_ Background: none;
_ Filter: progid: DXImageTransform. Microsoft. AlphaImageLoader (enabled = true, sizingMethod = scale, src = "20090318230119136.png ");
}
</Style>
<Body bgcolor = "# CCCCCC">
<Div class = "mycls"> </div>
</Body>


Css defines PNG background compatibility

IE6 PNG transparent ultimate solution (for details, see www.w3cfuns.com/thread-297-1-1.html)

Solution 1-filter solution
Solution 2-HTC plug-in solution

Solution 3-pure CSS Solution

Solution 4-native JavaScript Solution

Solution 5-jQuery Solution

Solution 6-PNG8 Format Image Solution

Solution 7-DD_belatedPNG Solution

Solution 8-EvPng Solution

I usually use the seventh type in the project, which is for reference only and self-selection.

DIV + CSS is compatible with the Shadow Effects of Various browsers.

We recommend that you still use images to create shadow effects. You can use table as an external frame in the layout to set the shadow to the outside, and use the background color for the main content inside, you only need to cut the translucent part of the image into png format. The cut effect is as follows:

Table layout is more convenient and error-free. It is also possible to use a pure div layout. You can nest the layout based on several cut charts. First, set the picture in the upper left corner as the background and set the padding-left: the width of the image. Then, add a div to the div, set the image in the upper right corner to the right, and set padding-right: The image width, finally, a div is nested in this div to set the above image to be horizontally tiled. You can set the height to complete the upper shadow. The middle method is similar to the bottom method, I will probably write the div layout and Code as follows:
<Div> <div style = "background: url (picture in the upper left corner) left bottom no-repeat; padding-left: 15px;"> <div style = "background: url (picture in the upper right corner) right bottom no-repeat; padding-right: 15px; "> <div style =" background: url (picture above) 0 bottom repeat-x; height: 18px; "> </div> <div style =" background: url (picture in the upper left corner) left 0 repeat-y; padding-left: 15px; "> <div style =" background: url (picture in the upper right corner) right 0 repeat-y; padding-right: 15px; "> <div style =" background: white; "> content </div> <div style =" background: url (image in the lower left corner) left top no-repeat; padding-left: 15px; "> <div style =" background: url (image in the lower right corner) right top no-repeat; padding-right: 15px; "> <div style =" background: url (image below) 0 top repeat-x; height: 25px; "> </div>
Note: IE6 is not compatible with png transparency. I have articles on Baidu space to solve this problem. You can go and have a look.

Time is limited. I can only enter these words and have to work hard.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.