gpt4 book ai didi

html - 导航栏 Div 正在覆盖另一个 Div

转载 作者:行者123 更新时间:2023-11-28 01:05:45 25 4
gpt4 key购买 nike

我正在处理一个网页。我做了一个顶部导航栏,我放了链接等等!现在我想添加一个设置按钮。该按钮有效,但是当我定位它时,它停止工作。我认为这是因为填充,但我不知道如何修复它。 The Padding Covers The Setting Button Code1

/*Navigation Bar Below*/

nav{
width: 100%;
height: 50px;
background-color: #aeaeae;
border-bottom: 5px solid #8d8d8d;
}

#list1{

}

#list1 li{
list-style: none;
display: inline-block;
line-height: 50px;
}

#list1 li a{
display: block;
text-decoration: none;
font-size: 14px;
font-family: MPLUS;
color: #ffffff;
padding: 0 20px;
}

#list1 li a:hover{
color: dodgerblue;
}

.inputWithIcon {
float: right;
padding-right: 37px;
}

/*Channel ID Search Below*/

input[type=text]{
width: 100%;
border: 2px solid #aaa;
border-radius: 4px;
margin: 8px 0;
outline: none;
padding: 8px;
box-sizing: border-box;
transition: .3s;
}

input[type=text]:focus {
border-color: dodgerblue;
box-shadow: 0 0 8px 0 dodgerblue;
}

input[type=text]{
width:100%;
border:2px solid #aaa;
border-radius:4px;
margin:8px 0;
outline:none;
padding: 8px;
box-sizing:border-box;
transition:.3s;
}

input[type=text]:focus{
border-color:dodgerBlue;
box-shadow:0 0 8px 0 dodgerBlue;
}

.inputWithIcon input[type=text]{
padding-right: 30px;
}

.inputWithIcon{
position:relative;
}

.inputWithIcon i{
position:absolute;
right: 34.5px;
top:8px;
padding: 9px 10px;
color:#aaa;
transition:.3s;
cursor: pointer;
}

.inputWithIcon input[type=text]:focus + i{
color:dodgerBlue;
}

.search1{
padding-right: 37px;
}

/* Menu Button Below*/

.box-shadow-menu {
position: absolute;
padding-right: 20px;
}

.box-shadow-menu:before {
content: "";
position: absolute;
right: 0;
top: 0.25em;
width: 1em;
height: 0.15em;
background: black;
box-shadow:
0 0.25em 0 0 black,
0 0.5em 0 0 black;
}

.SettingsButton1{
position:absolute;
right: 25px;
top:8px;
padding: 9px 10px;
}
		<div id="NavBar">
<nav>
<div class="SettingsButton1">
<i class="box-shadow-menu" aria-hidden="true" id="button" onclick="ViewsDisplay1()"></i>
</div>
<div class="Search1">
<div class="inputWithIcon">
<input type="text" placeholder="Channel ID" id="chnlname">
<i class="fa fa-search" aria-hidden="true" id="update"></i>
</div>
</div>
<ul id="list1">
<li><a href="#">Liker</a></li>
<li><a href="index.html">Live Count</a></li>
<li><a href="#">Logan IS Dumb</a></li>
</ul>
</nav>
</div>

最佳答案

您可以将 SettingsButton1 div 移到 Search1 div 之后。所以不是下面的代码..

<div class="SettingsButton1">
<i class="box-shadow-menu" aria-hidden="true" id="button" onclick="ViewsDisplay1()"></i>
</div>
<div class="Search1">
<div class="inputWithIcon">
<input type="text" placeholder="Channel ID" id="chnlname">
<i class="fa fa-search" aria-hidden="true" id="update"></i>
</div>
</div>

使用下面的代码。

<div class="Search1">
<div class="inputWithIcon">
<input type="text" placeholder="Channel ID" id="chnlname">
<i class="fa fa-search" aria-hidden="true" id="update"></i>
</div>
</div>
<div class="SettingsButton1">
<i class="box-shadow-menu" aria-hidden="true" id="button" onclick="ViewsDisplay1()"></i>
</div>

或者您可以将 z-index: 1 添加到 SettingsButton1 类样式。

更新 1:CSS 解决方案或者如果你只想用 CSS 来做,那么添加

.Search1{
position: relative;
padding-right: 37px;
}

并从 .inputWithIcon 类样式中删除 padding-right:37px..

关于html - 导航栏 Div 正在覆盖另一个 Div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52374145/

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