I am interested in having all the labels automatically expand to the size of the widest one. Below is the HTML structure:
<div class="body">
<ul class="list">
<li>
<span>
<label>condition</label>
<span>used</span>
</span>
</li>
<li>
<span>
<label>with invoice</label>
<span>yes</span>
</span>
</li>
<li>
<span>
<label>with warranty</label>
<span>no</span>
</span>
</li>
<li>
<span>
<label>with extra large text</label>
<span>not looking good!</span>
</span>
</li>
</ul>
</div>
In addition, here is the related CSS code:
.body {
background-color: #f1c40f;
padding: 1em;
width: 300px;
}
.list {
padding-bottom: 1em;
padding-top: 1em;
> li {
margin-bottom: 1em;
&:last-child {margin-bottom: 0;}
}
> li > span {
background-color: #e0e0e1;
border-radius: 5px;
color: #6c777f;
display: inline-block;
width: 100%;
}
label {
border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
background-color: #a1aab0;
color: white;
display: inline-block;
margin-bottom: 0;
margin-right: .5em;
min-width: 40%;
padding: .5em;
text-transform: capitalize;
}
}
The question remains - can all the labels adjust their size based on the length of the fourth label?
Fiddle: https://jsfiddle.net/emvidi/qe6bpn14/1/ Updated Fiddle for fluid design: https://jsfiddle.net/emvidi/qe6bpn14/4/