@Tatu Ulmanen是正確的,這是一個瀏覽器的默認問題。你不應該有要添加負邊距,您只需設置body/html標籤的默認CSS屬性即可。
爲了安全起見,您應該使用CSS重置以擺脫瀏覽器樣式默認值。以下是您可以用來解決問題的代碼。下面是一個很好的CSS重置,你可以從這裏開始添加到所有CSS樣式表的頂部。
html, body {
padding: 0;
margin: 0;
}
CSS復位: /* *復位/
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,
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-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; }
blockquote:before,
blockquote:after,
q:before, q:after { content: ""; }
blockquote, q { quotes: "" ""; }
body { line-height: 1; color: black; background: white; }
caption, th, td { text-align: left; font-weight: normal; }
:focus { outline: 0; }
table { border-collapse: separate; border-spacing: 0; }
ol, ul { list-style: none; }
感謝名單了很多! :)從來不知道重置樣式表是重要的:) – 2010-04-21 17:36:52