gpt4 book ai didi

javascript - Z 索引 : Materialize select always open in background

转载 作者:行者123 更新时间:2023-11-28 04:30:59 25 4
gpt4 key购买 nike

所以我使用 materialize css select 来设置表单中下拉菜单的样式。然而,当我登陆我的页面时,下拉菜单总是“隐藏打开”。更具体地说,如果我将鼠标悬停在“居住地”下拉列表的下方空白处,甚至悬停在表单的后面部分并单击,它将更改下拉列表的值。摆脱它的唯一方法是打开下拉菜单并关闭它。为什么会出现这种情况??有什么建议吗?

封闭无序列表的 Z 索引是 999。当我将它更改为 -1 时,它消失了,但是当我打开下拉列表时,它位于所有其他文本之后。

enter image description here

最佳答案

我又添加了一个名为 wrapper 的 div,并固定了页眉和页脚的位置。我还在包装器 div 中添加了页眉高度的填充,与页脚的情况相同。

希望对你有帮助

HTML:

<div class="wrapper" style="overflow-y: auto;overflow-x: hidden;padding-top: 34px;padding-bottom: 126px;">
<header id='header'>Test 0.1</header>
<aside id='aside'>
<p>Menu 1</p>
<p>Menu 2</p>
<p>Menu 3</p>
<p>Menu 4</p>
<p>
<span id='spn'>n</span>
</p>
</aside>
<section>
<div id='divMain'>
<table>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr><tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr><tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr><tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr><tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
</div>
</section>
<footer id='footer'>Address,
<br>phone,
<br>etc.
<br>
<br>Address,
<br>phone,
<br>etc.
</footer>
</div>

CSS:

html,
body {
height: 100%;
margin: 0;
overflow-x: hidden;
overflow-y: hidden;
}

body {
position: relative;
padding-top: 0;
overflow-y: auto;
}

header {
background-color: green;
color: white;
text-align: center;
font-weight: bold;
font-size: 30px;
position: fixed;
width: 100%;
top: 0;
}

section {
float: right;
width: 80%;
overflow-x: auto;
overflow-y: auto;
}

section div {
padding: 10px;
overflow-x: auto;
overflow-y: auto;
}

aside {
float: left;
background-color: lightgreen;
width: 20%;
}

aside p {
margin-left: 20px;
}

footer {
background-color: green;
color: white;
text-align: center;
clear: both;
position: fixed;
bottom: 0;
width: 100%;
}

table {
border-collapse: collapse;
}

th {
border: 1px solid black;
text-align: center;
font-weight: bold;
}

td {
border: 1px solid black;
text-align: center;
}

关于javascript - Z 索引 : Materialize select always open in background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41733659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com