Recently, I've been facing an issue with the tags on my website. When I hover over them, a remove icon appears, causing the tags to increase in size. This results in a problem where, if I hover over the rightmost tag and there isn't enough space for the remove icon, the tag either jumps to the bottom or doesn't get hovered over at all. This inconsistent behavior is definitely impacting the user experience in a negative way.
Any suggestions on how I can fix this issue? Is there a way to prevent the tags from moving when there isn't enough space for the remove icon upon hovering? I'm thinking, could we implement a designated safe area on the right side of the design specifically for the remove icon, only visible when hovering over a tag? It's crucial for me to maintain the current layout.
.container {
max-width: 500px;
margin: 0 auto;
display: flex;
}
.tags-container {
background-color: #a3b3c6;
padding: 20px;
display:flex;
flex-wrap: wrap;
}
.tag {
display: inline-flex;
transistion: all 1s ease-in-out;
padding: 3px;
background-color: white;
border: 1px solid black;
}
.tag-close {
margin-left: 10px;
height: 16px;
width: 16px;
display:none;
}
.tag:hover {
background-color: red;
}
.tag:hover .tag-close {
display: block;
}
.tags-remove-all {
display: flex;
align-items: center;
padding: 0 10px;
font-size: 32px;
}
<div class="container">
<div class="tags-container">
<div class="tag">
LBL-12334455579
<div class="tag-close">
x
</div>
</div>
<div class="tag">
LBL-12334578
<div class="tag-close">
x
</div>
</div>
<div class="tag">
LBL-1233
<div class="tag-close">
x
</div>
</div>
<div class="tag">
LBL-12334
<div class="tag-close">
x
</div>
</div>
<div class="tag">
LBL-12334
<div class="tag-close">
x
</div>
</div>
<div class="tag">
LBL-12334
<div class="tag-close">
x
</div>
</div>
</div>
<div class="tags-remove-all">
x
</div>
</div>