I'm working on creating an interesting grid effect:
https://i.sstatic.net/HO4H3.jpg
Here's the code I have so far:
HTML:
<div className='container'>
<div className='options-containers'>
<div className='landingcard'>
<div className='buttons-container color-venue'> </div>
<img className='background-image' src={VenueBackground} alt="" />
</div>
<div className='landingcard'>
<div className='buttons-container color-artists'></div>
<img src={BackgroundImage1} alt="Artists Picture" />
</div>
<div className='landingcard'>
<div className='buttons-container color-fans'></div>
<img src={FansBackground} alt="" />
</div>
</div>
</div>
CSS:
.landingcard{
position: relative;
}
.landingcard img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 25px;
}
.landingcard .color-fans{
background-color: #549FE5F2;
opacity: 0.8;
}
.landingcard .color-venue{
background-color: #FABF4D;
opacity: 0.8;
}
.landingcard .color-artists{
background-color: #FFB08B;
opacity: 0.8;
}
.landingcard .buttons-container {
position: absolute;
bottom: 0;
width: 100%;
height: 15%;
display: flex;
border-radius: 25px;
align-items: center;
justify-content: center;
transition: height 0.3s, opacity 0.3s;
}
.landingcard:hover .buttons-container {
height: 70%;
opacity: 1;
}
When compiled, each grid looks like this (text added for clarity): https://i.sstatic.net/tMlwB.png
and when hovered over,
https://i.sstatic.net/sMpJY.png
Currently, when hovering, the entire colored section expands, causing text to move. How can I ensure that new content stays within the expanded area without shifting position? (similar to the image above)