On my website, I am trying to make a list of tiles, each of which has an app:
body { background-color: gray; }
.tile {
width: 200px;
height: 250px;
white-space: nowrap;
overflow: hidden;
display: inline-block;
border: 5px solid white;
border-radius: 5px;
background-color: white;
margin: 50px;
text-wrap: wrap;
}
.tile:hover {
height: auto;
/* Uncover description */
scale: 105%;
cursor: pointer;
}
<div class="tile">Tile 1</div>
<div class="tile">Tile 2</div>
<div class="tile">Tile 3</div>
<div class="tile">Tile 4</div>
When you hover over one of these divs, it expands and shows the description (which increases the height). However, when it does this, every other tile in the list jumps to match the new height/alignment. This is quite annoying and I would like that to not happen. How can I get the siblings of the single tile to ignore the alignment of said tile?
2
Answers
This is what you are trying to achieve
If you use a flexbox and set
align-items: start
, then the other tiles in the same row won’t shift when you hover over a tile. However, tiles in subsequent rows will still shift down. Is this the effect you are looking for?