I'm creating a responsive website. There are multiple boxes (blocks). All of those boxes contain three items (spans) and right now, the space between them is distributed equally by flexbox (space-between) like this:
|-----------------------------|
| |
| Item1 Item2 Item3 |
| |
|-----------------------------|
The container resizes according to the screen size. Now, if the container box is too small, they wrap like this:
|------------------|
| |
| Item1 Item2 |
| Item3 |
| |
|------------------|
Is there a media-query-less way to have this happen instead?
|-----------------------------|
| |
| Item1 |
| Item2 |
| Item3 |
| |
|-----------------------------|
The current code looks like this:
<div class="project-details">
<span>Title 1 <span>Content 1</span></span>
<span>Title 2 <span>Content 2</span></span>
<span>Title 3 <span>Content 3</span></span>
</div>
The important parts of the CSS:
.project-details {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
border: 1px solid black;
}
.project-details > span {
font-weight: bold;
}
.project-details > span > span {
font-weight: normal;
}
You can play around with it at https://codepen.io/BuenaJormax/pen/grVAGk