I'm trying to show a notification overlay on a div. My attempt thus far has failed to get the overlay on top of everything, while keeping it relative to it's related button.
Perhaps using ::after isn't the right approach? Any suggestions would be appreciated.
.user-container {
display: flex;
flex-flow: column;
width: 300px;
float: left;
}
.user-welcome-message-container {
border-bottom: solid 2px #ffe398;
display: flex;
float: right;
text-align: right;
padding-top: 15px;
justify-content: flex-end;
}
.user-action-btns-container {
display: flex;
justify-content: flex-end;
}
#user-btn-1:hover {
cursor: pointer;
background-color: #c6e5ff;
border-top: solid 0px;
border-left: solid 1px #5babff;
border-bottom: solid 1px #5babff;
border-right: solid 1px #5babff;
box-sizing: border-box;
transition: 0.2s;
}
#user-btn-1 {
font-family: sans-serif;
font-style: normal;
position: relative;
width: 110px;
font-size: 0.8em;
color: black;
background-color: #fff3d3;
padding: 7px;
margin-right: 15px;
text-align: center;
box-sizing: border-box;
border-top: solid 0px;
border-left: solid 1px #e8cb2a;
border-bottom: solid 1px #e8cb2a;
border-right: solid 1px #e8cb2a;
border-radius: 0px 0px 5px 5px;
box-shadow: 0px 0px 5px rgb(0 0 0 / 20%);
clip-path: inset(0px -5px -5px -5px);
transition: 0.2s;
}
#favorites-btn-text::after {
content: "7";
position: absolute;
top: -5px;
left: 100px;
border-radius: 10px;
padding: 4px;
background-color: #a4dbff;
}
<div class="user-container">
<div class="user-welcome-message-container">
</div>
<div class="user-action-btns-container">
<div id="user-btn-1" title="Favorites">
<i aria-hidden="true" class="fa-solid fa-bookmark" title="Your favorites"> <span id="favorites-btn-text">Favorites</span></i>
</div>
</div>
</div>