28 Tháng 2Một số thủ thuật fix CSS trong IE6

  1. Inability to Have Elements with Small Heights

#element{
# background: #95CFEF;
# border: solid 1px #36F;
# width: 300px;
# height: 2px;
# margin: 30px 0;
# }4-2

4-1

Fix #1

The cause of this bug is pretty simple: IE simply refuses to size an element smaller than the set font size. Simply setting the font size to 0 lets you have an element as small and short as you like.

# #element{
# background: #95CFEF;
# border: solid 1px #36F;
# width: 300px;
# height: 2px;
# margin: 30px 0;
# font-size: 0;
# }

Fix #2

The next best way to deal with this bug is to apply overflow: hidden to the element so it collapses to the intended height.

# #element{
# background: #95CFEF;
# border: solid 1px #36F;
# width: 300px;
# height: 2px;
# margin: 30px 0;
# overflow: hidden
# }

Gửi lời bình luận