jjgod / blog Random notes by Jjgod Jiang.

CSS Negotiation

leftjustfied.net 给出了一篇介绍如何使 CSS 正常工作,节省你调试时间的文章:CSS Negotiation and a Sanity Saving Shortcut,其中的一些方法值得推荐。

首先,考虑到大量问题源自不同浏览器下默认的 margin 和 padding 的设置不同,作者建议干脆先把所有的 margin/padding 清零:

* {
  padding:0;
  margin:0;
}

第二,给 IE 设置特殊的样式表,可以使用下面 IE 专用的条件判断功能:

<!--[if IE] >
<link rel="stylesheet" href=" IE.css" media="screen" />
< ![endif]-- >

或者在 CSS 中使用 Tantek 发明的 band pass filter:

/* IE5 */
@media tty {
i{content:"";/*" "*/}};
@import 'ie5.css'; {;}/*";}
}/* */
/* IE 5.5 */
@media tty {
i{content:"";/*" "*/}}@m;
@import 'ie55.css'; /*";}
}/* */

更新:Andrew 在 Global White Space Reset 里主要说明了第一条规则的用途,你可以看看重新定义规则后的测试页面


9 Comments

Hi, I’m glad you liked my post enough to translate it :D There is a more detailed follow up here: Global White Space Reset Enjoy!

Posted by Andrew on 19 October 2004 @ 3pm

哈哈~~JJGOD,你的网站今天上《电脑报》(10月25日的月末版)了,建议你把以前的BLOG数据有都传上来吧~~

Posted by x5 on 25 October 2004 @ 8pm

By the way,is Andrew a foreigner?

Posted by x5 on 25 October 2004 @ 8pm

JJGOD 能不能简单解释一下“band pass filter”我不是很理解“`

Posted by Dboy on 27 October 2004 @ 10pm

http://www.stopdesign.com/examples/ie5mac-bpf

这里 Doug Bowman 给了 band pass filter 的一个很详细的解释。

Posted by jjgod on 27 October 2004 @ 10pm

Andrew 就是 leftjustfied.net 的 host…

原来的内容比较多,贴上来很花时间,我现在又没什么时间上网,只好再等等了…

Posted by jjgod on 28 October 2004 @ 12am

谢谢,能看明白 ^-^

Posted by Dboy on 28 October 2004 @ 1pm

Tantek 是个 bt…

Posted by PorkFat on 3 November 2004 @ 10am

[...] o锛佹垜浠鐨凜SS鍧︽湁涓浣嶅彨鍋歍antek鐨剆BT锛屾垜浠浣跨敤浠栫殑鍔炴硶鍚э紙鍙傝冮槄璇籆SS Negotiation锛夛細 /* IE5 / @media tty { i{content:”";/” “*/}}; @import ‘ie5.css’; {;} [...]

Posted by 鍗楁柟鍐滄皯 » IE 5.x IR hack on 30 June 2005 @ 4pm

Leave a Comment