Как сделать тултип выше скролла?

Рейтинг: 0Ответов: 0Опубликовано: 04.06.2023

Как сделать тултип выше скролла?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    * {
        box-sizing: border-box;
        padding: 0
    }

    .scrollable-container {
        width: 300px;
        height: 200px;
        overflow-y: auto;
        border: 1px solid #ccc;
    }
    .content {
        height: 100px;
        display: flex;
        justify-content: flex-end;
        background-color: aqua;
        position: relative; /* Добавлено */
        cursor: pointer; /* Добавлено */
    }
    .tooltip {
        visibility: hidden;
        background-color: #333;
        color: #fff;
        text-align: center;
        border-radius: 6px;
        padding: 5px;
        position: absolute;
        z-index: 10;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
    }
    .content:hover .tooltip {
        visibility: visible;
    }
</style>
<body>
<div class="scrollable-container">
    <div class="scrollable-content">
        <div class="content">
            блок
            <span class="tooltip">Тултип Тултип Тултип Тултип Тултип Тултип Тултип Тултип Тултип Тултип Тултип Тултип</span>
        </div>
        <div class="content">
            блок
            <span class="tooltip">Тултип</span>
        </div>
    </div>
</div>
</body>
</html>

введите сюда описание изображения

введите сюда описание изображения

Ответы

Ответов пока нет.