亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

IE條件語(yǔ)句 IE hack大全

 更新時(shí)間:2012年05月23日 19:17:04   作者:  
條件注釋只有在IE瀏覽器被支持,因此僅適用于IE的特殊指令。從IE5起都支持
Conditional comments work as follows:
復(fù)制代碼 代碼如下:

<!--[if IE 6]>Special instructions for IE 6 here<![endif]-->
[code]

Their basic structure is the same as an HTML comment (<!-- -->). Therefore all other browsers will see them as normal comments and will ignore them entirely.
IE, though, has been programmed to recognize the special <!--[if IE]> syntax, resolves the ifand parses the content of the conditional comment as if it were normal page content.
Since conditional comments use the HTML comment structure, they can only be included in HTML files, and not in CSS files. I'd have preferred to put the special styles in the CSS file, but that's impossible. You can also put an entire new <link> tag in the conditional comment referring to an extra style sheet.
Example
Below I added a lot of conditional comments that print out messages according to your IE version.

Note however, that if you use multiple Explorers on one computer, the conditional comments will render as if all these Explorer versions are the highest Explorer version available on your machine (usually Explorer 6.0).

Test
Below are a few conditional comments that reveal the IE version you're using.

According to the conditional comment this is IE
According to the conditional comment this is IE 7
According to the conditional comment this is IE lower than 9
According to the conditional comment this is IE lower or equal to 7
According to the conditional comment this is IE greater than 6

Code
The syntax I use is:
[code]
<p class="accent">
<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<![endif]-->
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<![endif]-->
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]-->
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<![endif]-->
<!--[if !IE]> -->
According to the conditional comment this is not IE<br />
<!-- <![endif]-->
</p>

Note the special syntax:

gt: greater than
lte: less than or equal to
Also note the last one. It has a different syntax, and its contents are shown in all browsers that are not IE:
復(fù)制代碼 代碼如下:

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


CSS hack?
Are conditional comments CSS hacks? Strictly speaking, yes, since they can serve to give special style instructions to some browsers. However, they do not rely on one browser bug to solve another one, as all true CSS hacks do. Besides, they can be used for more than CSS hacks only (though that rarely happens).

Since conditional comments are not based on a browser hack but on a deliberate feature I believe they are safe to use. Sure, other browsers could implement conditional comments, too (though as yet none have done so), but they're unlikely to react to the specific query <!--[if IE]>.

I use conditional comments, though sparingly. First I see if I can find a real CSS solution to an Explorer Windows problem. If I can't, though, I don't hesitate to use them.

Comment tag
A reader told me IE also supports the (non-standard) <comment> tag.

<p>This is <comment>not</comment> IE.</p>

This isIE.

This tag might be a replacement for the !IE conditional comment.

相關(guān)文章

  • Iris 環(huán)境搭建詳細(xì)教程(最新版Go&IDEA&IrisV12)

    Iris 環(huán)境搭建詳細(xì)教程(最新版Go&IDEA&IrisV12)

    這篇文章主要介紹了Iris 環(huán)境搭建(最新版Go&IDEA&IrisV12),本文通過示例圖文相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-11-11
  • Loongnix安裝PyCharm Community 2020.2.3的教程詳解

    Loongnix安裝PyCharm Community 2020.2.3的教程詳解

    這篇文章主要介紹了Loongnix安裝PyCharm Community 2020.2.3的教程詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-11-11
  • Django 使用 cookie 實(shí)現(xiàn)簡(jiǎn)單的用戶管理功能

    Django 使用 cookie 實(shí)現(xiàn)簡(jiǎn)單的用戶管理功能

    這篇文章主要介紹了Django 使用 cookie 實(shí)現(xiàn)簡(jiǎn)單的用戶管理功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-06-06
  • 微信應(yīng)用號(hào)(小程序)入門安裝教程及IDE(破解版)下載

    微信應(yīng)用號(hào)(小程序)入門安裝教程及IDE(破解版)下載

    這篇文章主要介紹了微信應(yīng)用號(hào)(小程序)入門安裝教程及IDE下載的相關(guān)資料,需要的朋友可以參考下
    2016-09-09
  • Windows10使用Anaconda安裝Tensorflow-gpu的教程詳解

    Windows10使用Anaconda安裝Tensorflow-gpu的教程詳解

    Anaconda是一個(gè)方便的python包管理和環(huán)境管理軟件,一般用來(lái)配置不同的項(xiàng)目環(huán)境。這篇文章主要介紹了Windows10使用Anaconda安裝Tensorflow-gpu的教程,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-02-02
  • HTTP頭信息總結(jié)

    HTTP頭信息總結(jié)

    這篇文章主要介紹了HTTP頭信息總結(jié),HTTP的頭域包括通用頭、請(qǐng)求頭、響應(yīng)頭和實(shí)體頭四個(gè)部分,本文羅列了40個(gè)HTTP頭信息,需要的朋友可以參考下
    2014-07-07
  • 解決Visual Studio 2019本地不能運(yùn)行Azure Functions

    解決Visual Studio 2019本地不能運(yùn)行Azure Functions

    本文主要介紹了Visual Studio 2019本地不能運(yùn)行Azure Functions的解決方方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-06-06
  • 8種類型極品程序員,不知你屬于哪一種?

    8種類型極品程序員,不知你屬于哪一種?

    這篇文章主要介紹了8種類型極品程序員,不知你屬于哪一種?本文總結(jié)歸納了8種程類型的程序員,總結(jié)的非常精辟,來(lái)看看你是屬于哪一種吧~
    2014-09-09
  • 嘁,都2020了,你咋還在單純的使用if-else

    嘁,都2020了,你咋還在單純的使用if-else

    我們?cè)趯懗绦驎r(shí),常常需要指明兩條或者更多的執(zhí)行路徑,使得程序執(zhí)行時(shí),能夠選擇其中一條路徑,去執(zhí)行相應(yīng)的語(yǔ)句,產(chǎn)生對(duì)應(yīng)的結(jié)果 —— 這也是條件語(yǔ)句在程序中的作用。下面通過例子給大家介紹下if-else的使用,感興趣的朋友一起看看吧
    2020-10-10
  • 微信小程序開發(fā)工具介紹

    微信小程序開發(fā)工具介紹

    這篇文章主要為大家介紹了微信小程序開發(fā)工具及基本的使用,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步早日升職加薪
    2022-04-04

最新評(píng)論