Way back in the day, we had to deal with browsers adding white space between elements if in the source markup we also had white space.
I thought that issue had all but disappeared but I rant into a situation today where the problem still exists. What's odd is that the problem isn't confined to a particular browser. It shows up the same problematic way in Firefox, Safari, Chrome and Opera and only slightly differently in IE.
Sample CSS:
<style type="text/css">
li {
display: inline;
background: pink;
margin: 0px;
padding: 10px 0px;
}
li a {
background: green;
margin: 0px;
padding: 0px;
}
</style>
Sample markup:
<ul>
<li>
<a href="#">hello</a>
</li>
<li>
<a href="#">world</a>
</li>
</ul>
<ul>
<li><a href="#">hello</a></li>
<li><a href="#">world</a></li>
</ul>
<ul>
<li><a href="#">hello</a></li><li><a href="#">world</a></li>
</ul>
Only that last UL appears the way I'd like it to appear...with the A tags spanning the full width of the container LI tag.
Given the consistency across browsers, this maybe is actually rendering as it should? Short of reverting to old comment hacks (starting a comment on the end of one line and expanding to the beginning of the next) anyone know of a workaround for this or why this is doing what it does?
Ideally, I'd float my LI's instead, but due to some other issues keeping then inline would be preferred.