I have a label and multiple tags that might span multiple lines:
.container {
background-color: #ddd;
display: flex;
width: 200px;
margin-bottom: 50px;
}
.label {
margin-right: 10px;
}
.boxes-container {
display: flex;
flex-wrap: wrap;
}
.box {
display: inline-block;
height: 40px;
width: 60px;
margin-bottom: 10px;
margin-right: 10px;
background-color: blue;
}
<div class="container">
<label class="label">Tags:</label>
<span class="boxes-container">
<span class="box"></span>
<span class="box"></span>
</span>
</div>
<div class="container">
<label class="label">Tags:</label>
<span class="boxes-container">
<span class="box"></span>
<span class="box"></span>
<span class="box"></span>
<span class="box"></span>
</span>
</div>
This is the current layout:
https://i.sstatic.net/RfcZK.png
I want to achieve the following objectives:
- Ensure the label and the first row of tags are aligned along the same horizontal line.
- Eliminate the extra space below the last line of tags while maintaining the space between the two rows of tags.
Here is how I envision the desired result:
https://i.sstatic.net/E6mql.png
What steps should I take to accomplish this?