.profile__change-image-button should appear on hover (while the image changes opacity to 0.8) and clicking on it is supposed to open a form. With my current code, opacity is applied on hover and the icon does appear, but it disappears with every move of the mouse, which it makes it difficult to open the popup form. The end result should be- opacity changed to 0.8 on hover + icon appear and disappear only when the mouse moves outside the borders of the image. Thank you very much in advance!
.profile__user {
max-width: 583px;
display: flex;
position: relative;
}
.profile__image {
background-size: cover;
background-position: center;
width: 120px;
height: 120px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.profile__change-image-button {
width: 26px;
height: 26px;
background: transparent;
border: none;
position: absolute;
left: 47px;
bottom: 56px;
}
.profile__change-image-button-hide {
display: none;
}
.profile__image:hover {
opacity: 0.8;
}
.profile__image:hover + .profile__change-image-button-hide {
display: block;
}
<div class="profile__user">
<div
class="profile__image"
title="An image of the French oceanographer- Jacques Cousteau"
></div>
<div class="profile__change-image-button-hide">
<button type="button" class="profile__change-image-button">
<img
src="<%=require('./images/edit-profile-icon.svg')%>"
alt="A vector image of a pen inside the profile image"
class="profile__change-image-icon"
/>
</button>
</div>
<div class="profile__info">
<h1 class="profile__title"></h1>
<button type="button" class="profile__edit-button">
<img
src="<%=require('./images/button-edit.svg')%>"
alt="A vector image of a pen inside the edit button"
class="profile__edit-icon"
/>
</button>
<p class="profile__subtitle"></p>
</div>
</div>