gpt4 book ai didi

html - 导航栏上只有文本链接

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

我看过其他类似的问题,但无法将其应用于我的问题。我希望每个文本链接周围的框都可以点击,而不仅仅是文本。

HTML

<div class="container">
<ul class="nav">
<li class="nav-home">
<a href="index.html">Home</a>
</li>
<li class="nav-games">
<a href="games.html">Games</a>
</li>
<li class="nav-chat">
<a href="chat.html">Chat</a>
</li>
<li class="nav-suggestions">
<a href="suggestions.html">Suggestions</a>
</li>
</ul>
</div>

CSS

.nav {
width: 900;
clear: right;
height: 55px;
margin-left: 22px;
margin-right: 22px;
padding: 0;
z-index: 5;
overflow: visible;
background: #161616;
background: -moz-linear-gradient(top, #161616 0%, #282828 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#161616), color-stop(100%,#282828));
background: -webkit-linear-gradient(top, #161616 0%,#282828 100%);
background: -o-linear-gradient(top, #161616 0%,#282828 100%);
background: -ms-linear-gradient(top, #161616 0%,#282828 100%);
background: linear-gradient(to bottom, #161616 0%,#282828 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#161616', endColorstr='#282828',GradientType=0 );
border: 1px solid #090909;
box-shadow: inset 0px 0px 1px rgba(255,255,255,.2), 0px 3px 5px rgba(0,0,0,.5);
}

.nav li {
list-style-type: none;
float: left;
display: inline-block;
padding: 0px 89px;
width: 55;
text-align: center;
height: 55px;
border-right: 1px solid #090909;
box-shadow: 1px 0px 0px rgba(255,255,255,.1);
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2inear;
-o-transition:all 1s linear;
transition:all 0.2s linear;
}

.nav li.logo:hover { opacity: 1; background-color: transparent;}

.nav li:last-child { border: none; box-shadow: none; }

我在此处添加了 display: block; 使文本的上方和下方可点击,但左侧或右侧不可点击。

.nav li a, nav ul li a:visited {
line-height: 55px;
text-decoration: none;
display: block;
color: #9c9c9c;
font-size: 15px;
font-family: "Droid Sans", Arial, sans-serif;
text-transform: uppercase;
text-shadow: 0px 1px 0px rgba(0,0,0,.9);
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2s linear;
-o-transition:all 0.2s linear;
transition:all 0.2s linear;
}

.nav li:hover {
background-color: rgba(0,0,0,.2);
background-color: #191919\9;
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2s linear;
-o-transition:all 0.2s linear;
transition:all 0.2s linear;
color: white;
}
.nav li:hover a { color: white;
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2s linear;
-o-transition:all 0.2s linear;
transition:all 0.2s linear;
}

#nav-home .nav li.nav-home a, #nav-games .nav li.nav-games a, #nav-chat .nav li.nav-chat a,
#nav-comments .nav li.nav-comments a { color: white; }

这是 jsfiddle http://jsfiddle.net/U2d9X/3/为了视觉效果。如果您能提供帮助,我们将不胜感激。如果需要任何更多信息或说明,请询问而不是拒绝这个问题。

最佳答案

1) 从 LI 元素中删除左/右填充。

2) 调整 LI 元素的宽度。

3) a { width: 100% !important;高度:100%!重要; }

关于html - 导航栏上只有文本链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15390549/

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