The better I get at css (and I am getting better) I really start to understand designers hatred for IE. I guess I always knew it on some level but when you are really trying to write clean code it starts to upset you that you have to hunt down IE6 specific bugs. My advise to everyone working with css is to get your layout/design working in a standards compliant browser and then double back to find out what bugs you need to fix. The bug I came across today (I have before but this is a great fix) is the IE Whitespace bug.

I was trying to create a block level list elements for a navigation like flow. When you use the code below and check the output in FireFox everything is exactly how you want it. In IE though there is extra space between elements. Here is the code and what it looks like in both browsers. The one on the left is FF and the right is IE6.

view plain print about
1<html>
2<head>
3    <title>Lists Example</title>
4    <style>
5    #navigation {
6        width:200px;
7    }
8    h3 {
9        margin:0px;
10        padding:0px;
11        border-bottom:1px dotted #272727;
12    }
13    ul {
14        margin:0px;
15        padding:0px;
16        list-style-type:none;
17    }
18    li a {
19        color: #759398;
20        text-decoration: none;
21        padding-top: 4px;
22        padding-right: 0px;
23        padding-bottom: 4px;
24        padding-left: 2px;
25        display: block;    
26        border-bottom:1px dotted #272727;
27    }
28    li a:hover {
29        text-decoration: none;
30        background-color: #132022;
31        color: #ffffff;
32    }
33    </style>
34</head>
35<body>
36    
37    <div id="navigation">
38    <h3>Navigation</h3>
39    <ul>
40        <li><a href="##">Menu Item 1</a></li>
41        <li><a href="##">Menu Item 2</a></li>
42        <li><a href="##">Menu Item 3</a></li>
43        <li><a href="##">Menu Item 4</a></li>
44        <li><a href="##">Menu Item 5</a></li>
45        <li><a href="##">Menu Item 6</a></li>
46        <li><a href="##">Menu Item 7</a></li>
47        <li><a href="##">Menu Item 8</a></li>
48        <li><a href="##">Menu Item 9</a></li>
49        <li><a href="##">Menu Item 10</a></li>
50    </ul>
51    </div>
52
53</body>
54</html>

One solution to the problem I found that I really like was hicksdesign.co.uk. After reading through the comments though some users pointed out that the css may not validate so I ended up going with a solution from the comments. Placing the following code in your css will fix the problem and the css will validate. The final outlook looks good in all the browsers that I tested.

view plain print about
1<style>
2* html ul li a {
3    height:1em;
4}
5</style>