Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS overflow: auto hiding tooltip

Tags:

html

css

I have a tooltip which gets hidden due to overflow: auto on the parent div.

<div id="content">
    <div id="wrapper">
        <div class="item"><span class="tooltip">Tooltip text</span></div>
        <div class="item"><span class="tooltip">Tooltip text</span></div>
        <div class="item"><span class="tooltip">Tooltip text</span></div>
    </div>
</div>

#wrapper {
    width: 400px;
    height: 100px;
    border: 1px solid #ccc;
    border-radius: 10px;
    overflow: auto;
    padding: 10px;
}
.item {
    width: 50px;
    height: 50px;
    border: 1px solid #ccc;
    border-radius: 10px;
    margin-top: 10px;
    position: relative;
}
.item:hover .tooltip {
    visibility: visible;
}
.item .tooltip {
    visibility: hidden;
    background-color: black;
    color: #fff;
    padding: 5px 0;
    border-radius: 6px;
    overflow: auto;
    z-index: 1;
    width: 100px;
    position: absolute;
}

JSfiddle link

like image 650
user544079 Avatar asked Aug 02 '26 22:08

user544079


1 Answers

Set the position: absolute; to position: fixed; in tooltip class

like image 133
Pushpendra Avatar answered Aug 04 '26 14:08

Pushpendra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!