8月28

css+div设计时IE与Firefox的主要区别

| |
20:47 W3C前端技术  From: 本站原创
1、Firefox设置 padding 后, div 会增加 height 和 width, 但 IE 不会, 故需要用 !important 多设一个 height 和 width。

2、Firefox支持 !important, IE 则忽略, 可用 !important 为 FF 特别设置样式,值得注意的是,一定要将xxxx !important 这句放置在另一句之上

如:

Firefox里的宽度为:500+5+5=510px,所以要把Firefox的宽度设置成490px才可以
IE里变500px

修改后的代码:


3、Firefox cursor: pointer 可以同时在 IE FF 中显示游标手指状, hand 仅 IE 可以

4、在firefox和IE中的BOX模型解释不一致导致相差2px解决方法:div{margin:30px!important;margin:28px;}

注意这两个margin的顺序一定不能写反,!important这个属性IE不能识别,但别的浏览器可以识别。所以在IE下其实解释成这样:div{maring:30px;margin:28px}

5、Firefox: div 设置 margin-left, margin-right 为 auto 时已经居中, IE 不行

6、Firefox: body 设置 text-align 时, div 需要设置 margin: auto(主要是 margin-left,margin-right) 方可居中
最后编辑: tommyhu 编辑于2009/08/28 20:47
阅读(3946) | 评论(0) | 引用(0)
在此留下酱油瓶-:)
表情
emotemotemotemotemotemotemotemotemotemotemotemotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我

您的大名(例如:小明) : 

密码(可不填) :  游客无需密码

网址 (可不填) : 

电邮 (可不填) :  [注册]