gpt4 book ai didi

html - LI 内的链接未覆盖整个 LI

转载 作者:太空宇宙 更新时间:2023-11-03 21:28:12 31 4
gpt4 key购买 nike

我正在尝试创建一个网站,但我偶然发现了一个小问题,我正在使用 bootsnipp(一个侧面菜单)中的一个片段,我无法让它工作,所以链接将覆盖整个 LI,而不是你必须按自己的文字如果我改变它,那么它会坐在 li 之前,它看起来不合适我怎样才能解决这个问题截图链接:http://bootsnipp.com/snippets/featured/responsive-navigation-menu

我的代码:HTML:

<div class="nav-side-menu" style="float: left; position: fixed; width: 15.6%;">
<div class="brand"><img alt="Brand" src="includes/img/LogoTest1.png" width="10%"> <b>Craft-List.net</b></div>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li class="active"><a href="/beta/index"><i class="glyphicon glyphicon-home"></i> Home</a></li>
<li class=""><a href="#"><i class="glyphicon glyphicon-user"></i> Members</a></li>
<li class=""><a href="#"><i class="glyphicon glyphicon-envelope"></i> Contact</a></li>
<li class=""><a href="#"><i class="glyphicon glyphicon-question-sign"></i> About</a></li>
<li class=""><a href="#"><i class="glyphicon glyphicon-plus"></i> Login/Register</a></li>
</ul>
</div>

CSS:

.nav-side-menu {
overflow: auto;
font-family: verdana;
font-size: 12px;
font-weight: 200;
background-color: #2e353d;
position: fixed;
top: 0px;
width: 300px;
height: 100%;
color: #e1ffff;
}
.nav-side-menu .brand {
background-color: #23282e;
line-height: 50px;
display: block;
text-align: center;
font-size: 14px;
}
.nav-side-menu .toggle-btn {
display: none;
}
.nav-side-menu ul,
.nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 35px;
cursor: pointer;
/*
.collapsed{
.arrow:before{
font-family: FontAwesome;
content: "\f053";
display: inline-block;
padding-left:10px;
padding-right: 10px;
vertical-align: middle;
float:right;
}
}
*/
}
.nav-side-menu ul :not(collapsed) .arrow:before,
.nav-side-menu li :not(collapsed) .arrow:before {
font-family: FontAwesome;
content: "\f078";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
float: right;
}
.nav-side-menu ul .active,
.nav-side-menu li .active {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
}
.nav-side-menu ul .sub-menu li.active,
.nav-side-menu li .sub-menu li.active {
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li.active a,
.nav-side-menu li .sub-menu li.active a {
color: #d19b3d;
}
.nav-side-menu ul .sub-menu li,
.nav-side-menu li .sub-menu li {
background-color: #181c20;
border: none;
line-height: 28px;
border-bottom: 1px solid #23282e;
margin-left: 0px;
}
.nav-side-menu ul .sub-menu li:hover,
.nav-side-menu li .sub-menu li:hover {
background-color: #020203;
}
.nav-side-menu ul .sub-menu li:before,
.nav-side-menu li .sub-menu li:before {
font-family: FontAwesome;
content: "\f105";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
}
.nav-side-menu li {
padding-left: 0px;
border-left: 3px solid #2e353d;
border-bottom: 1px solid #23282e;
}
.nav-side-menu li a {
text-decoration: none;
color: #e1ffff;
}
.nav-side-menu li a i {
padding-left: 10px;
width: 20px;
padding-right: 20px;
}
.nav-side-menu li:hover {
border-left: 3px solid #d19b3d;
background-color: #4f5b69;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
@media (max-width: 767px) {
.nav-side-menu {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.nav-side-menu .toggle-btn {
display: block;
cursor: pointer;
position: absolute;
right: 10px;
top: 10px;
z-index: 10 !important;
padding: 3px;
background-color: #ffffff;
color: #000;
width: 40px;
text-align: center;
}
.brand {
text-align: left !important;
font-size: 22px;
padding-left: 20px;
line-height: 50px !important;
}
}
@media (min-width: 767px) {
.nav-side-menu .menu-list .menu-content {
display: block;
}
}
body {
margin: 0px;
padding: 0px;
}

我在这里问的原因是因为那个片段看起来有点死气沉沉,最新的评论是 4 个月前的。

另外,我对 css 和 html 还很陌生,我编写的 php 代码比设计代码多:|无论如何,我很乐意看到一些带有示例的东西,如果它被要求太多,纯文本将起作用

提前致谢!

最佳答案

我认为您必须将 display: block; 放到 a 元素中,该元素默认具有 display: inline;

.nav-side-menu li a {
display: block;
}

关于html - LI 内的链接未覆盖整个 LI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31294660/

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