I am trying to figure out how i can set display:block; on all the p tags and on the overlay div when im hovering my img tag. Is this possible only with CSS or would i have to figure something out with javascript. Or should i change the way i approach this? All help is appreciated thanks.
.staff-pic-contain {
height: 250px;
width: 250px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.staff-pic {
height: 100%;
width: 100%;
border-radius: 50%;
}
p {
font-weight: bold;
position: absolute;
color: white;
display: none;
}
.name {
margin-top: 15%;
}
.number {
margin-top: 25%;
}
.overlay {
background-color: red;
height: 100%;
width: 100%;
border-radius: 50%;
position: absolute;
top: 0;
opacity: 0.75;
display: none;
}
img:hover {
cursor: pointer;
}
<div class="staff-pic-contain">
<img class="staff-pic" src="https://picsum.photos/g/200/300" alt="">
<p class="position"> CEO </p>
<p class="name"> NAME </p>
<p class="number"> 123123 </p>
<div class="overlay"></div>
</div>