php网页编程中用CSS HACK来区分不同的分辨率和不同的浏览器
网页在不同的浏览器和不同的分辨率下有不同的显示效果,颇为头疼。网上查找了一些信息,这里把基本的一些摘录下来。
————————————————
body{
background:orange; /*FF*/
*background:green !important; /*IE7*/
*background:blue; /*IE6*/
}
解释: Firefox读取的是第一行,而忽略第2,3行。因为这两行有*在前。 IE7读取的是第1,2行,根据优先权,第2行最终显示。 IE6读取第1,3行,根据优先权,第3行最终显示。
上面书写的顺序:首先是FF,其次是IE7,再次是IE6
————————————————
另外一种是:
*+html #id{} 仅IE7识别
* html #id{} 仅IE6识别
————————————————
还有一种IE中的IF语句:
<!–[if IE]>
<h1>您正在使用IE浏览器</h1>
<!–[if IE 5]>
<h2>版本 5</h2>
<![endif]–>
<!–[if IE 5.0]>
<h2>版本 5.0</h2>
<![endif]–>
<!–[if IE 5.5]>
<h2>版本 5.5</h2>
<![endif]–>
<!–[if IE 6]>
<h2>版本 6</h2>
<![endif]–>
<!–[if IE 7]>
<h2>版本 7</h2>
<![endif]–>
<![endif]–>
————————————————
上面这个IF语句是判断IE系列的,如果一同再判断FF,那需要改为:
<!–[if IE 7]><!–>
</a>
<!–<![endif]–>
<!–<table><tr><td>
<ul>
<li><a href=”#”>A</a></li>
</ul>
</td></tr></table>–>
<!–[if lte IE 6]>
</a>
<![endif]–>
- 未完 -
Comments
Leave a Reply
You must be logged in to post a comment.
