I have four list items and I want three of them to stay the same size and the other one to be at with of 300px.
My HTML:
<ul class="test">
<li class="desc">Test description</li>
<li class="test">Test</li>
<li class="test">Test</li>
<li class="test">Test</li>
</ul>
My SASS:
ul.test {
flex: 1 0 auto;
flex-direction: row;
display: flex;
}
li.desc{
width: 300px;
}
li.test{
background: green;
flex: 1 0 auto
}
I want the first li to be 300px in width and then the other three to be the same size.
ul.test {
display: flex;
padding: 0;
list-style: none;
}
li.desc {
width: 300px;
flex-shrink: 0; /* disable default shrinking behavior */
background-color: orange;
}
li.test {
flex: 1; /* distribute free space evenly among items */
background: lightgreen;
}
li{ border-right: 1px solid black; }
<ul class="test">
<li class="desc">Test description</li>
<li class="test">Test</li>
<li class="test">Test</li>
<li class="test">Test</li>
</ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With