I want to display all buttons aligned to fill full div width, except for the last one. My code is below, but the last div is short and is expanding full width, I don't want this for the last one.
NOTE: The buttons are dynamically generated.
.block {
width: 400px;
display: flex;
flex-wrap: wrap;
}
.button {
background-color: #cec;
border: none;
color: white;
margin: 15px;
padding: 15px;
display: inline-block;
font-size: 16px;
flex: 1 0 auto;
}
<div class="block">
<div class="button"><a href="#">#1 - A LONG TEXT GOES HERE</a>
</div>
<div class="button"><a href="#">#2 - ANOTHER LONG TEXT HERE</a>
</div>
<div class="button"><a href="#">#3 - SOME TEXT HERE</a>
</div>
<div class="button"><a href="#">#4 - SHORT TEXT</a>
</div>
<div class="button"><a href="#">#5 - SHORT</a>
</div>
<div class="button"><a href="#">#6 - SHORT</a>
</div>
</div>