重置CSS - 将填充和边距设置为0?

时间:2012-01-24 07:42:57

标签: css reset

查看YUI 2: Reset CSS,他们在多个元素上设置了margin:0padding:0。我不关心我的网页上的IE6或IE7。我还需要为每个元素设置margin:0吗?

  • div(no)
  • ol(是)
  • ul(是)
  • li(no)
  • 表格(仅限IE6,IE7)
  • 输入(否)
  • textarea(不)

我还需要为每个元素设置padding:0吗?

  • body(no)
  • div(no)
  • ul(是)
  • ol(是)
  • li(no)
  • 表格(不)
  • textarea(是)
  • p(no)

我还需要为图片设置border:0吗?

答:仅适用于链接图片

你推荐的其他什么?

2 个答案:

答案 0 :(得分:3)

您可以在此网站上查找IE的内置样式表:http://www.iecss.com/

它包含Firefox,WebKit和Opera风格的链接。您可以交叉引用这些来做出决定。

答案 1 :(得分:0)

总是使用这个:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        font-size: 100%;
        vertical-align: baseline;
        background: transparent;
}
body {
        line-height: 1;
}
ol, ul {
        list-style: none;
}
blockquote, q {
        quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
        content: '';
        content: none;
}

/* remember to define focus styles! */
:focus {
        outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
        text-decoration: none;
}
del {
        text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
        border-collapse: collapse;
        border-spacing: 0;
}
相关问题