I'm in the process of creating a website using the flexbox
property. My goal is to have the color of the boxes change when a user hovers over them, and I want the boxes to adjust accordingly on mobile devices.
Below is my code snippet:
HTML:
<div id="site-features" class="features-box">
<a href="#"><h3>My heading 3 - one</h3> <img src="/assets/img1.png" height="95px" alt="read out"></a>
<a href="#"><h3>My heading 3 - two</h3> <img src="/assets/img2.png" height="95px" alt="read out"></a>
<a href="#"><h3>My heading 3 - three</h3> <img src="/assets/img3.png" height="95px" alt="read out"></a>
<a href="#"><h3>My heading 3 - four</h3> <img src="/assets/img4.png" height="95px" alt="read out"></a>
<a href="#"><h3>My heading 3 - five</h3> <img src="/assets/img5.png" height="95px" alt="read out"></a>
</div>
CSS:
.features-box {
margin: 30px;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
justify-content: center;
align-items: center;
width: 1560px;
height: 380px;
background-color: rgb(6, 67, 122);
padding: 5px;
/* this */
}
.features-box>a {
text-decoration: none;
flex: 1 1 auto;
border: 5px rgb(255, 255, 255) solid;
margin: 5px;
width: 500px;
background-color: brown;
height: 250px;
position: relative;
text-align: center;
color: white;
}
.features-box>a:hover {
color: green;
}
The issue I'm facing is that when hovered over, the effect only applies to the text rather than the entire box itself. How can I remedy this situation so that the hover effect covers the entire box rather than just the text within it?