允许一个col溢出到另一个

时间:2019-11-04 08:05:57

标签: css

我正在尝试使用绝对位置显示下拉菜单,但是div不可点击。

我尝试使用溢出自动,空白:nowrap,z-index:999,指针事件,这些都不起作用

我希望此下拉列表作为正常的登出菜单重叠在所有列和文本上。current state of my dropdown menu

<!DOCTYPE html>
<html lang="en">

<head>
    <title>pagedemo</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<style>

.dropdown{
    border-radius: 4px;
    background-color: white;
    width: 8.25rem;
    left: 3rem;
    min-height: 4rem;
    color: gray;
    bottom: 0rem;
    box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.11);
    overflow-x: scroll;
    background-color: yellowgreen;
    padding:10px;
    margin-top: 10rem;
}
.dropdownOption{
    width: 8.25rem;
}
.dropdownOption:hover{
    cursor: pointer;
    background-color: honeydew;
}

.leftNav{
    background-color: white;
    height: 100vh;
}
</style>

<body style="background-color: bisque;">
        <div class="container">
        <div class="row">
            <div class="col-1, leftNav" >
                <div class="dropdown">
                    <div class="dropdownOption">
                        logout
                    </div>
                    <div class="dropdownOption">
                        account settings
                    </div>

                </div>
            </div>
            <div class="col-10" style="background-color: tomato;">
                data
            </div>
        </div>
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

您应该在z-index组件上添加一个.leftNav,以确保它位于主栏的前面。

提琴:https://jsfiddle.net/azkq2480/