As I dive into the world of HTML and CSS, I've come across a hurdle when it comes to hovering over divs and displaying hidden elements. The goal is for the card to change color on hover (which I've achieved), expand in size, and reveal hidden content. However, the issue arises when hovering over one card causes all other cards to increase in size as well, even though their hidden information remains concealed. The only workaround I've found is removing 'display:flex' from the .services_cards element, but this causes the entire layout to collapse, preventing the desired expansion effect. I attempted using nth-child selectors without success. Can someone provide guidance on how to solve this problem? To better visualize the scenario, switch to full-screen mode for improved clarity.
.services__cards {
margin-top: 58px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.services__item {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background-color: #FFF1F9;
border-radius: 8px;
padding: 56px 23px;
margin-right: 30px;
}
.services__item:last-child {
margin-right: 0;
}
.services__item:hover {
background-color: #F78BB6;
-webkit-transition: 0.5s;
transition: 0.5s;
}
.services__item:hover .services__card-header, .services__item:hover .services__card-descr {
color: #FFF;
}
.services__item:hover .services__learnmore {
display: inline-block;
}
.services__card-header {
margin-top: 38px;
font-weight: 500;
font-size: 34px;
line-height: 72px;
color: #56597A;
}
.services__card-descr {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 24px;
color: #919299;
text-align: center;
}
.services__learnmore {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-decoration: none;
color: inherit;
font-weight: 500;
font-size: 20px;
line-height: 30px;
margin-top: 40px;
display: none;
}
.services__learnmore span {
margin-right: 5px;
}
<div class="services__cards">
<div class="services__item">
<img src="images/cards/card-icon1.png" alt="card-icon image">
<h3 class="services__card-header">Design</h3>
<div class="services__card-descr">a plan or drawing produced to show the look and function</div>
<a href="/" class="services__learnmore"><span>Learn more</span><img src="images/cards/arrow.png" alt="arrow image"></a>
</div>
<div class="services__item">
<img src="images/cards/card-icon2.png" alt="card-icon image">
<h3 class="services__card-header">Development</h3>
<div class="services__card-descr">Development is defined as the process of growth or new</div>
<a href="/" class="services__learnmore"><span>Learn more</span><img src="images/cards/arrow.png" alt="arrow image"></a>
</div>
<div class="services__item">
<img src="images/cards/card-icon3.png" alt="card-icon image">
<h3 class="services__card-header">Branding</h3>
<div class="services__card-descr">The marketing practice of creating a name, symbol or</div>
<a href="/" class="services__learnmore"><span>Learn more</span><img src="images/cards/arrow.png" alt="arrow image"></a>
</div>
<div class="services__item">
<img src="images/cards/card-icon4.png" alt="card-icon image">
<h3 class="services__card-header">Illustration</h3>
<div class="services__card-descr">An illustration is a decoration, interpretation or visual</div>
<a href="/" class="services__learnmore"><span>Learn more</span><img src="images/cards/arrow.png" alt="arrow image"></a>
</div>
</div>