Given this markup:
<ul class="grafiek">
<li class="first-child">item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li>item</li>
<li class="last-child">item</li>
</ul>
How do I make it appear, cross-browser, like so:
In other words: the last item (with the fake pseudo-class last-child
) should always stretch to accomodate the cumulative total width of the previous, arbitrary amounts (within reason of course), of <li>
's
This is what I have so far:
ul.grafiek {
float: left;
}
ul.grafiek li {
float: left;
display: block;
margin-left: 6px;
width: 56px;
height: 66px;
padding: 12px 0;
color: #fff;
text-align: center;
font-size: 11px;
line-height: 1;
background-color: #c5015a;
}
ul.grafiek li.first-child {
margin-left: 0;
}
ul.grafiek li.last-child {
clear: both;
margin: 10px 0 0 0;
width: 100%;
height: 23px;
padding: 0;
line-height: 23px;
background-color: #0a2d7f;
}
IE6 stretches the last <li>
to the total width of the <ul>
's parent. IE7 doesn't stretch it at all. How do I make it work in these two browsers also?
PS.: Firefox, Chrome and Opera work a expected.