I am looking to make tiles flow horizontally until there is no more space, then wrap to the next line. Additionally, I want them to be responsive to different screen sizes. Here is my initial code snippet:
.tile {
width: 248px;
height: 126px;
background-color: #e4e4e4;
margin: 17px;
}
.title {
display: block;
float: left;
padding-left: 13px;
font-size: 20px;
padding-top: 8px;
}
<div class="tile">
<label class="title">Tile1</label>
</div>
<div class="tile">
<label class="title">Tile2</label>
</div>
<div class="tile">
<label class="title">Tile3</label>
</div>
<div class="tile">
<label class="title">Tile4</label>
</div>
<div class="tile">
<label class="title">Tile5</label>
</div>
<div class="tile">
<label class="title">Tile6</label>
</div>
<div class="tile">
<label class="title">Tile7</label>
</div>
<div class="tile">
<label class="title">Tile8</label>
</div>
<div class="tile">
<label class="title">Tile9</label>
</div>
I want Tiles 1, 2, and 3 in the first row, then 4, 5, and 6 in the second row, and so on, all in a responsive manner (This is just an example - the number of tiles in each row should adjust automatically based on page width).
How can I achieve this layout without using JavaScript?