CSS Hack兼容

CSS中有很多标签在不同浏览器中有不同的兼容性问题,问了让网页的功能更好的不同浏览器中显示正常, 需要通过hack的方式来解决浏览器兼容问题。

CSS hack问题由来已久,目前我的了解甚少,以下是转载别人的介绍。这篇文章详细的介绍了CSS hack,提供了hack解决浏览器兼容的方法。

链接:http://blog.csdn.net/freshlover/article/details/12132801


height、top通过计算的方式进行浏览器兼容。

*height:expression(((document.documentgetElement.clentHeight>0)?document.documentElement.clientHeight:document.clientHeight)+"px");

_top:expression((document.documentElement.srcollTop-this.offsetHeight+this.offsetHeight)+"px"));




Demo:

<div id="pagephoto" style="opacity:0;filter:alpha(opacity=100);position:fixed;_position:absolute; left:0; top:0; right:0; bottom:0; z-index:9999; text-align:center;*height:expression(((document.documentElement.clientHeight>0)?document.documentElement.clientHeight:document.documentElement.clientHeight)+'px');*100%;_top:expression((document.documentElement.scrollTop-this.offsetHeight+this.offsetHeight)+'px');">
<div style="position:absolute; left:0; top:0; right:0; bottom:0; background:#000;" onClick="$('#pagephoto').slideUp('slow')"></div>
<div style=" display:inline-block;*display:inline; 1px; height:100%; margin:0 -0.5em 0 -1px; position:relative; vertical-align:middle;"></div>
<a href="http://www.faw-mazda.com/index.php/detail/cx-4/121#main" target="_blank"><img src="http://www.faw-mazda.com/data/template/mazda/images/index/show_cx4.jpg" style="max-100%; max-height:100%; vertical-align:middle; position:relative;"></a>
</div>


链接:http://www.faw-mazda.com/