這份並非微軟官方文件,而是有人靠實測整理出來的 IE6 預設樣式表。對我們要「馴服」IE6 來說參考價值很高,因為你能從根源理解那些 bug 為什麼會發生。
可惜 IE 不像 Firefox 那樣,能在網址列打一行指令就把預設樣式叫出來看。以下 Values 標註為「推估值」,帶 < 與 > 的數值屬於不確定項,且實際結果會受 hasLayout 屬性影響。
html, body,
div, p,
blockquote,
ul, ol, dl,
dt, dd, address,
form, fieldset,
frame, frameset,
h1, h2, h3, h4,
h5, h6, hr, pre { display: block; }
head { display: none; }
html { margin: 0; }
body { margin: 8px; }
div { margin: 0; }
p { margin: 1em 0; }
blockquote { margin: 1em 40px; }
ul { margin: 1em 0 1em 40px; list-style-type: disc; }
ol { margin: 1em 0 1em 40px; list-style-type: decimal; }
li { display: list-item; }
ul ul { margin: 0 0 0 40px; list-style-type: circle; }
ul ul ul { margin: 0 0 0 40px; list-style-type: square; }
dl { margin: 1em 0; }
dd { margin-left: 40px; }
address { margin: 1em 0; font-style: italic; }
form, fieldset { margin: 0; }
fieldset { border: 1px inset <系統色彩>; }
h1, h2, h3, h4, h5, h6 { font-weight: bold; }
hr { border: 2px outset <系統色彩>; }
pre { margin: 1em 0; font-family: monospace; white-space: pre; }
標題的字級與上下間距會隨 body 上的 font-size / font-family 變動,以下數值僅供參考:
h1 { font-size: 2em; margin: .6em 0; }
h2 { font-size: 1.5em; margin: .8em 0; }
h3 { font-size: 1.1em; margin: 1em 0; }
h4 { font-size: 1em; margin: 1.3em 0; }
h5 { font-size: 0.8em; margin: 1.6em 0; }
h6 { font-size: 0.6em; margin: 2.3em 0; }
a, i, cite, em, var, acronym,
tt, code, kbd, samp, del, ins,
u, dfn, sub, sup, big, small { display: inline; }
a:link { color: blue; text-decoration: underline; }
a:visited { color: purple; text-decoration: underline; }
i, cite, em, var { font-style: italic; }
tt, code, kbd, samp { font-family: monospace; }
del { text-decoration: line-through; }
u, ins { text-decoration: underline; }
sub { vertical-align: sub; font-size: smaller; line-height: <值>; }
sup { vertical-align: super; font-size: smaller; line-height: <值>; }
big { font-size: larger; }
small { font-size: smaller; }
IE6 的置換元素中,值得留意的主要是表單控制項:
input, textarea { display: inline-block; }
把這份清單和 HTML 4 的建議樣式表對照著看,你會發現 IE6 的很多「莫名其妙」其實都有跡可循:body 預設 8px 外距、清單縮排靠 40px 的左邊距、fieldset 自帶 inset 邊框。理解這些起點,再回頭寫 CSS Reset 或針對 IE 的覆寫,思路會清楚很多。