一、CSSHACK
专门为某版本的浏览器设置样式,从而解决浏览器显示的差异。
IE各版本:
selector { +property:value; } 在属性名前加上加号"+",这个Hack只有IE系列可以识别.
selector { *property:value; } 在属性名前加上星号"*",这个Hack只有IE系列可以识别.
selector { _property:value; } 在属性名前加上下划线"_",这个Hack只有IE系列 (除IE7外) 识别.
* html selector{ property:value; } 在选择器上运用继承法 * html selector, 这个Hack只有IE系列 (除IE7外) 可以识别.
html/**/ >body selector { property:value; } 在选择器上运用继承法 html/**/ >body selector ,这个Hack只有IE系列 (除IE7外) 可以识别.
selector { property/**/:value; } 在属性名和冒号":"之间加入注释,屏蔽IE6用.
selector/**/ { property/**/:value; } 在选择器和花括号"{"之间以及在属性名和冒号":"之间加入注释,屏蔽IE5和IE6用 (不屏蔽IE5.5) .
select/**/ { property:value; } 在选择器和花括号"{"之间加入注释,屏蔽IE5用.
*+html selector { property:value !important; } 在选择器上运用继承法 *+html selector 再加上 !important, 这个Hack只有IE7可以识别.
Firefox:
*:lang(lang) selector { property:value !important; } 用伪类lang(语言)再加上!important进行定义的话,目前只有Firefox可以识别.
Safari:
selector:empty { property:value !important; } 用伪类empty再加上!important进行定义的话,目前只有Safari可以识别.
Opera:
@media all and (min-width: 0px){ selector { property:value; } } 利用特殊继承法进行定义的话,目前只有Opera可以识别.
二、万能 float 闭合
解决没设置浮动的标签被float标签撑开的问题。
.clearfix: after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html.clearfix {
* html.clearfix {
zoom:1;
}
* +html.clearfix {
* +html.clearfix {
zoom:1;
}
.clearfix {
.clearfix {
display: inline - block;
}
.clearfix {
display: block;
}
如果本篇文章帮到了你,那么,请点击右侧的百度分享,让我们一起帮助更多的朋友!