I have a layout consisting of a single ordered list containing a bunch of items.
All items have consistent width and height - except the first item - which is (3x) wider and (2x) taller. It looks like this:
ol {
padding:0;
margin:0;
min-width: 488px;
}
li {
list-style: none;
width: 150px;
padding-bottom: 16.66%;
border: 5px solid tomato;
display: inline-block;
}
li:first-child {
float:left;
width: 478px;
border-color: green;
padding-bottom: 34.25%;
margin: 0 4px 4px 0;
}
<ol>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
Codepen Demo (Resize viewport to see effect)
Currently, i'm using floats and inline-blocks to achieve the layout, but i'd like to use flexbox because of some extra features which flexbox offers.
I have made a couple of attempts, but with no success -
Attempt #1 - Codepen
ol {
/* ... */
display: flex;
flex-wrap: wrap;
}
Attempt #2 - Codepen
Use a float before the list to secure space for the first large list item
Then set display absolute on the first list item.
In both attempts, the red boxes in the first line stretch to fill the height of the first item.
Is this possible?
(If not, then I would be interested in a CSS grid workaround)