1.2 KiB
1.2 KiB
title, tags
| title | tags |
|---|---|
| Remove inline-block container whitespace | layout, beginner |
Creates a bouncing loader animation.
<div class="tiles">
<div class="tile">
<img class="tile_image" src="https://via.placeholder.com/250x150" alt="placeholder" >
<h2 class="tile_title">30 Seconds of CSS</h2>
</div>
<div class="tile">
<img class="tile_image" src="https://via.placeholder.com/250x150" alt="placeholder" >
<h2 class="tile_title">30 Seconds of CSS</h2>
</div>
<div class="tile">
<img class="tile_image" src="https://via.placeholder.com/250x150" alt="placeholder" >
<h2 class="tile_title">30 Seconds of CSS</h2>
</div>
</div>
.tiles {
width: 900px;
font-size: 0;
}
.tile {
width: calc(900px / 3);
display: inline-block;
}
.tile h2 {
font-size: 20px;
}
Explanation
tilesis the container of the tile componenttileis the item that we need to display inlinewidth: calc((900px / 3) - 10px)divides the width of the tile evenly- Set
font-size: 0;on.tilesto avoid whitespace - Set
font-size: 20pxtoh2in order to display the text