“vertical-align: baseline” causes a list margin bug in IE 6/7
If you use Eric Meyer’s version of Reset CSS, be careful of the side effect of “vertical align: baseline” in IE.
If you use Eric Meyer’s version of Reset CSS, be careful of the side effect of “vertical-align: baseline” in IE.
In reset.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,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
...
vertical-align: baseline;
...
}
It can cause some IE bugs in list items (and table cells, but not mentioned in this post).
A list item with background color and border-bottom: 1px solid #fff should looks like this:
Expected result: the list items sit directly next to each other without an extra margin.
But if you use reset.css, it might look like this:
IE 6/7 bug: vertical-align: baseline adds an unexpected margin between the list items.
It costs me 2 hours to figure out what the bug is, and how to solve it. So here is the easy fix:
#blah li {
vertical-align: bottom;
}
Hope I will not need to google it one day.
Related
推薦閱讀
前陣子接到 izero 與 jwbai 兩位長輩的邀約,到 KKBOX 給了兩場演講。因為最近正好有些心得,所以就把投影片重新整理過了一遍。
這幾天跑到老貓家撒野,聊了些網頁中文排版的事情,有興趣討論的朋友,可以看看「段落的秘密」這篇。因為自己起先的留言講得不清不楚,有朋友寄信來問,所以就順手做了個簡單的範例:中文段首縮排。不過我覺得就橫書的方塊字而言,段首縮排對易讀性 (readability) 的幫助並不大,所以並不建議使用啦。
承上 當代網頁設計,XHTML+CSS ,今天是第三場課程。原本今天會簡介 JavaScript 的,不過由於我花不少時間在作業跟範例講解,又應人要求講了約二十分鐘的 XML 介紹,還順便補充了之前幾個沒講完的部份,所以就沒多的時間了。我把一些不該放出來的東西清掉之後,發現剩下沒多少東西耶,請大家將就看看 O o