Centering absolute element above relative parent element
Hi! So I've been scratching my head a bit, I'm making a tooltip that is position absolute that I want centered and above when hovering the icons, and the content of the tooltip is of varying length so I cannot set a static number to hack it.
This is the code for the tooltip :
This is the code for the parent:
and here's a screenshot of the behavior
This is the code for the tooltip :
.tooltip {
position: absolute;
bottom: calc(100% + 0.5rem);
left: 0;
right: 0;
width: fit-content;
padding: 4px 8px;
border-radius: 5px;
visibility: visible;
background-color: hsl(0, 0%, 65%);
color: hsl(0, 0%, 95%);
z-index: 1;
}This is the code for the parent:
.language {
position: relative;
width: 32px;
}
and here's a screenshot of the behavior

