css hack小小总结

css教程评论171 views阅读模式

css hack是指各个浏览器及其版本对css解析后生成效果差异。

css hack主要解决浏览器有IE6、IE7、IE8、chrome、Firefox、Safari、Opera,其他浏览器就

不用解决了,一般都是基于上面内核的,而且使用比例比较少。

对于IE浏览器:

<pre class="prettyprint linenums bush:css" lang="css"><style> p{ width:400px; height:400px; background-color:red; background-color:blue\9; /*所有IE*/ background-color:yellow\0; /*IE8 hack*/ _background-color:#CDCDCD; /* ie 6*/ *+html background-color:white; /*仅IE7*/ *background-color:pink; /*IE6 IE7 hack*/ @background-color:white; /*opera hack*/ } </style> <p>php点点通-关注php开发,提供专业php教程<p>

对于Firefox:

<pre class="prettyprint linenums bush:css" lang="css">*:lang(lang) selector { property:value !important; }

用伪类lang(语言)再加上!important进行定义的话,目前只有Firefox可以识别.

对于Safari:

<pre class="prettyprint linenums bush:css" lang="css">selector:empty { property:value !important; }

用伪类empty再加上!important进行定义的话,目前只有Safari可以识别.

对于Opera:

<pre class="prettyprint linenums bush:css" lang="css">@media all and (min-width: 0px){ selector { property:value; } }

利用特殊继承法进行定义的话,目前只有Opera可以识别.

最后附上一张css hack表格:

<a title="css.jpg" href="http://www.php.cn/">

0.jpg

css.jpg" />

企鹅博客
  • 本文由 发表于 2020年9月1日 15:50:11
  • 转载请务必保留本文链接:https://www.qieseo.com/356164.html

发表评论