手机
当前位置:查字典教程网 >编程开发 >其他综合 >IE条件语句 IE hack大全
IE条件语句 IE hack大全
摘要:Conditionalcommentsworkasfollows:复制代码代码如下:[code]Theirbasicstructureist...

Conditional comments work as follows:

复制代码 代码如下:

<>

[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]>

According to the conditional comment this is IE<br />

<![endif]-->

<>

<>

<>

<>

<>

<>

<>

<>

<>

According to the conditional comment this is not IE<br />

<>

</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:

复制代码 代码如下:

<>

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.

【IE条件语句 IE hack大全】相关文章:

Git 教程简单入门介绍

微信小程序应用号开发体验

Runnable.com 在线测试代码片分享网站

学编程选什么语言好?是PHP、Python还是Ruby?

Http 状态代码 指示(ajax,bs结构用的到)

分享下网站开发人员应该知道的61件事

±àÂëÊ·¼Ç

Web Jmeter–接口测试工具详解

IE 打开服务器下的MHT文件的实现方法

支付宝 接口开发帮助(asp,php,asp.net,jsp)

精品推荐
分类导航