Given the following markup:
<ul>
<li><span>One</span></li>
<li><span>Two</span></li>
<li><span>Three</span></li>
<li><span>Four</span></li>
<li><span>Five</span></li>
</ul>
And the following CSS:
body {
font-family: Arial, sans-serif;
font-size: 14px;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
}
li {
border-bottom: 1px solid red;
float: left;
margin-left: 10px;
height: 70px; /* height of largest element */
}
span {
font-weight: bold;
display: block; /* important, needs to be block */
}
li:nth-child(2) {
font-size: 2em;
}
li:nth-child(3) {
font-size: 3em;
}
li:nth-child(4) {
font-size: 4em;
}
li:nth-child(5) {
font-size: 5em;
}
Where each list item contains text of a different size.
I would like to align each <span> element to the bottom of it’s parent <li> ensuring that the bottom borders also align.
Here is the jsfiddle of this not working.
Need to support IE8 > upwards.
Note: The items have to be floated
Remove
float:leftfrom li and adddisplay:inline; vertical-align:bottom;DEMO