css屬性中background與_background的區別介紹

來源:互聯網
上載者:User
css樣式表中有如下語句:

.imminbox { width:39px; height:29px;padding-right:3px; cursor:pointer; position:absolute ;right:1px; bottom:0px;z-index:20; overflow: visible; background:url(../images/im_minbar.png) no-repeat; _background:url(../images/im_minbar.gif) no-repeat; top:auto;}

不知道_background屬性應該如何理解

*html .imbox{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0))-35);}

css中有這麼一句,“*html”是什麼意思,怎麼理解呀?

1,_background 是IE6的hank 屬性, 在樣式屬性前加“ _ ” 只有ie6能識別;樣式從嚮往下運行,一直運行到不能執行為止.

比如

style{ color:#000000;                  /* FF,OP支援 */ color:#0000FF\9;       /* 所有瀏覽器IE瀏覽器(ie6+)支援 ;但是IE8不能識別“*”和“_”的css hack;所以我們可以這樣寫hack */ [color:#000000;color:#00FF00;      /* SF,CH支援 */ *color:#FFFF00;                 /* IE7支援 */ _color:#FF0000;                 /* IE6支援 */}

2,關於*html .imbox
也是屬於ie 6 的hank . 為能解決ie 6的特定問題而設定的。

*html 是表示IE6的hack寫法,等同於上面的_background:url(...)中用到的“_屬性”。

這種屬性通常接在正常屬性後面,比如.class{ background:blue; _background:red;},意思即是除IE6背景色都是藍色,IE6背景色則是紅色。換成*html的寫法便是: .class { background:blue; } *html .class{ background:red },都是一個效果。

這是考慮到不同版本IE的問題,_background這個屬性是只對IE6起效!因為IE6對png的透明屬性不支援!所以當使用者瀏覽器是IE6的時候就會自動使用_background這個樣式!你沒看到背景圖片是gif格式的嘛

相關文章

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.