Is there a way to align a series of li
items to the bottom of their parent, the ul
, without using any unconventional methods? The challenge lies in the fact that these li
items need to have a float: left
property and vary in height and width.
Below is my current code:
ul {
width: 1000px;
height: 400px;
float: left;
vertical-align: bottom; /* Although present, it doesn't influence the list items due to the float: left */
}
ul li {
float: left;
display: inline-block;
}
ul li figure {
margin: 0; padding: 0;
width: 150px;
height: 150px;
background: red;
}
ul li:nth-child(2n) figure {
width: 300px;
height: 300px;
}
<ul>
<li>
<figure>
<img />
</figure>
</li>
<li>
<figure>
<img />
</figure>
</li>
<li>
<figure>
<img />
</figure>
</li>
<li>
<figure>
<img />
</figure>
</li>
</ul>
Ideally, I want to achieve the layout shown in the following image, maintaining variable widths for the ul
and with no gaps between list items: