CSS裡的if條件hack怎麼寫

來源:互聯網
上載者:User
今天為大家講解DIV+CSS中if條件hack知識與教程執行個體,各位朋友可以借鑒一下我們的這個例子。希望下面的案列對你有所協助。

IE的CSS if條件Hack- css hack

為大家講解DIV+CSS中if條件hack知識與教程執行個體

目錄

Css if hack條件文法

DIV+CSS if執行個體

if條件hack總結

Css if hack條件文法

<!--[if IE]> Only IE <![endif]-->

僅所有的WIN系統內建IE可識別

<!--[if IE 5.0]> Only IE 5.0 <![endif]-->

只有IE5.0可以識別

<!--[if gt IE 5.0]> Only IE 5.0+ <![endif]-->

IE5.0包換IE5.5都可以識別

<!--[if lt IE 6]> Only IE 6- <![endif]-->

僅IE6可識別

<!--[if gte IE 6]> Only IE 6/+ <![endif]-->

IE6以及IE6以下的IE5.x都可識別

<!--[if lte IE 7]> Only IE 7/- <![endif]-->

僅IE7可識別

<!--[if gte IE 7]> Only IE 7/+ <![endif]-->

IE7以及IE7以下的IE6、IE5.x都可識別

<!--[if IE 8]> Only IE 8/- <![endif]-->

僅IE8可識別

2、DIV+CSS執行個體教程

CSS執行個體一:

讓IE6-IE8顯示不同的內容,DIV CSS代碼如下:

 <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>DIV IF條件執行個體</title></head><body>你正在使用:<!--[if IE 7]> <h2>IE7</h2><![endif]--><!--[if IE 6]> <h2>IE6</h2><![endif]--><!--[if IE 8]> <h2>IE8</h2><![endif]--><br><br><strong>說明</strong>:如果你的瀏覽器版本為多少即會顯示IE多少,針對IE6-IE8實驗CSS教程 </body></html>DIV+CSS執行個體二:讓IE6-IE8顯示不同CSS樣式效果,DIV CSS代碼如下: <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>CSS IF條件hack執行個體 </title><!--[if IE 6]> <style type="text/css">.div{ color:#F00;}</style><![endif]--><!--[if IE 7]> <style type="text/css">.div{ color:#FF0;}</style><![endif]--><!--[if IE 8]> <style type="text/css">.div{ color:#00F;}</style><![endif]--></head><body><div class="div">DIV CSS實驗提示:<br>我在IE6下是紅顏色,在IE7下是黃顏色,在IE8下是藍顏色</div></body></html>

說明:以上實驗僅實驗IE6-IE8下if HACK。更多精彩請關注php中文網其它相關文章!

相關閱讀:

怎樣用css3做出表徵圖效果

利用CSS3怎麼做出不規則圖片的切換特效製作

怎麼用CSS3做出燈光照射顯示文字動畫

相關文章

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.