CSS兼容性(1) !important
许多人认为ie6不支持!important,其实是被一条针对ie 6的css hack给误导了。这条css hack是:
.test {
height: auto !important;
height: 500px;
}
.test的高度在其他浏览器里面是auto,而在ie6里面是500px,许多人在解释这条css hack之所以会生效是因为ie6不支持!important,误导了不少人。
其实ie6本身是支持!important的,下面换一种写法:
.test {
height: auto !important;
}
.test {
height: 500px;
}
发现ie6里面.test的高度也是auto,这说明ie6是支持!important的。那上面的hack之所以会生效是因为ie6的一个小小的bug,即当你把两条相同的声明放到同一个选择器里面的时候ie6才不认识!important。然而大部分时候,这个小小的bug并不影响我们在ie6内使用!important。
相关文档:
1.图片的垂直居中
.box
{
/*非IE的主流浏览器识别的垂直居中的方法*/
display: table-cell;
vertical-align: middle; /*设置水平居中*/
text-align: center;
/* 针对IE的Hack */
*display:block;
......
magento个别页面添加css和js文件,可以将其放在个别页面的xml中,或者放在CMS的layout update中,其代码和文件存放位置如下
<reference name="head">
<action method="addCss"><stylesheet>css/mystyles.css</stylesheet></action>
//添加css mystyles.css 文件在 /skin/frontend/主题 ......
盒子标签和属性对照
CSS语法(不区分大小写) JavaScript语法(区分大小写)
border border
border-bottom borderBottom
border-bottom-color &nbs ......
效果图:
源码: 保存为html文件, 在IE6及以上版本IE浏览器可以运行....
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
&nb ......
2010-01-26
@import调用css和link href调用有什么区别?
文章分类:Web前端
大家去分析一些大站的css代码时,都会发现调用css有以下两种方法:
方法一:
<style type="text/css">
<!--
@import url("css/main.css");
@import url("css/font.css");
@import url("css/layout.css");
-->
</style ......