Common css compatibility problems

Source: Internet
Author: User

Link dashed box

<!-- html --><a class="noDashedBox" href="#"></a>
/** A, img, input, and other labels are clicked with a dotted box * removing it */. noDashedBox {outline: 0; blr: expression (this. onFocus = this. blur ());}

Fixed Positioning

<!-- html --><a class="fixedTop" href="#"></a><a class="fixedBottom" href="#"></a>
/*  css  */.fixedTop {    position:fixed;    top:100px;    left:50%;    margin-left:500px;    _position:absolute;    _top:expression(eval(document.documentElement.scrollTop + 100));}.fixedBottom {    position:fixed;    bottom:50px;    left:50%;    margin-left:500px;    _position:absolute;    _top:expression(eval(document.documentElement.scrollTop + document.documentElement.clientHeight - 70));}

Png background image transparency: for ie6

<!-- html --><div class="pngOpacity"></div>
/** Http://www.zhangxinxu.com/wordpress/2009/08/ +
* Ie6 % E4 % B8 % 8 Bpng % E8 % 83% 8C % E6 % 99% AF % E4 % B8 % 8D % E9 % 80% 8F % E6 % 98% 8E % E9 % 97% AE % E9 % A2 % 98% E7 % 9A % 84% E7 % BB % BC % E5 % 90% 88% E6 % 8B % 93% E5 % B1 % 95/** ie6 png8 background cannot be located * /. pngOpacity {height: 228px; background: url (http://www.bkjia.com/uploads/allimg/140611/1209455A8-0.png) no-repeat; _ background: none; _ filter: progid: DXImageTransform. microsoft. alphaImageLoader (enabled = 'true', sizingMethod = 'crop', src = 'HTTP: // www.bkjia.com/uploads/allianz 140611/1209455a8-0.png ');}
// Png transparent JavaScript solution http://www.zhangxinxu.com/study/js/png.jsif (! Window. XMLHttpRequest) {window. attachEvent ("onload", enableAlphaImages);} function enableAlphaImages () {for (var I = 0; I <document. all. length; I ++) {var obj = document. all [I]; var bg = obj. currentStyle. backgroundImage; var img = document. images [I]; if (bg & bg. match (/\. png/I )! = Null) {var img = bg. substring (5, bg. length-2); var offset = obj. style ["background-position"]; obj. style. filter = "progid: DXImageTransform. microsoft. alphaImageLoader (src = '"+ img +"', sizingMethod = 'crop') "; obj. style. background = "none";} else if (img & img. src. match (/\. png $/I )! = Null) {var src = img. src; img. style. width = img. width + "px"; img. style. height = img. height + "px"; img. style. filter = "progid: DXImageTransform. microsoft. alphaImageLoader (src = '"+ src +"', sizingMethod = 'crop') "img. src = "http://s1.95171.cn/ B /img/pixel.gif"; // Replace the transparent PNG Image
 } } }

Opacity transparency: The entire element is transparent, including the content in the element.

<!-- html --><div class="opacity"><span style="color:yellow;">this is opacity text</span></div><div class="opacity"><span style="color:yellow;position:relative;">this is text that not opacity in ie</span></div>
.opacity {    background: #000;    filter:alpha(opacity=50);    *zoom:1;   /* sometimes it is needed */    opacity: 0.5;    font-size: 38px;    color:#fff;    }

Rgba transparency: only transparent to the background, the content will not be affected

<!-- html --><div class="rgbaAlpha">red green blue and alpha</div>
/* css */.rgbaAlpha {    width:300px;    height:auto;    padding:50px;    filter:progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7F000000,endcolorstr=#7F000000);    background: rgba(0, 0, 0, 0.5);    font-size: 38px;    color:#fff;}

 

Related Article

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.