gpt4 book ai didi

css - 自定义 horiz.menu CSS 底部边框技巧?需要

转载 作者:太空宇宙 更新时间:2023-11-03 22:07:27 26 4
gpt4 key购买 nike

嵌入的图片描述了我的布局。如您所见,问题出在我的水平菜单中。首先,它是右对齐的,然后所选选项卡没有底部边框(这会产生一种封面效果)。如果您选择第二个选项卡,那么第二个 li 将没有底部边框,其余的将被连接起来。

问题是,如何做到这一点?我能想到的唯一解决方案是 :hover img,它将是空白的以删除选定的底部边框。

CSS layout preview

到目前为止的代码:

body
{
font:100% 'century gothic', Verdana, Arial, Helvetica, sans-serif;
color:#3F3F3F;
}
#wrapper
{
width:960px;
height:700px; /*temp*/
margin:0 auto;
background:#FFF;
}

#header /*not visible on the embedded layout*/
{
width:960px;
height:91px;
}

#nav-bar
{
width:960px;
height:50px;

border-bottom:#000070 1px solid;
/*
If only <ul> has bottom border then i wouldn't have the bottom border for
the whole #nav-right. But this is also a problem for the selected
tab that doesn't have any
*/
}
#nav-left
{
float:left;
width:73px;
height:50px;
border-right:1px #000070 solid;
}
#nav-right
{
float:left;
width:882px;
height:50px;

display:inline-block;
position:relative;
/*now i can use absolute on the <ul> for bottom-right positioning*/
}
#nav-right ul
{
list-style: none;
/*padding: ... ;*/

position:absolute;
bottom:0px;
right:5px;

border-top:1px solid #000070;
border-left:1px solid #000070;
border-right:1px solid #000070;
}
#nav-right li
{
display:inline-block;
/*padding: ...;*/
}
#nav-right li a
{
/*padding: ...;*/
text-decoration:none;
margin:0;
color:#CCC;
}
#nav-right li a:hover
{
color:#000070;
font-weight:bold;
}
#content
{
width:960px;
clear:both;
}
#con-left{/*...*/}
#con-right{/*...*/}



HTML STRUCTURE:

<body>
<div id="wrapper">

<div id="header"><img src="#" /></div>

<div id="nav-bar">
<div id="nav-left"></div>
<div id="nav-right">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Items</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div> <!--END: nav-bar-->

<div id="content">
<div id="con-left"></div>
<div id="con-right">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultrices semper orci in euismod. Proin sed justo at lectus dapibus <br>
interdum. Donec quis elit massa, id porttitor eros. Nullam vel consectetur diam. <br>
Phasellus bibendum, justo sed vehicula luctus, velit lectus rhoncus velit, at placerat nibh sapien quis felis. Mauris id aliquet. <br>
Integer mattis convallis luctus. Vivamus suscipit euismod sodales. Suspendisse cursus, erat eu egestas gravida, est mi semper ,<br>
quis sagittis purus mi sit amet nisl. Praesent adipiscing molestie sem. Mauris vitae arcu nibh, tristique laoreet nisi. Proin quis<br>
id sapien condimentum facilisis et at odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. <br>
Morbi eget est elit, nec rutrum enim. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.<br>
</p>
</div>
</div>


</div><!--END: wrapper-->

关于如何实现所选标签的无底边框效果有什么建议吗?

我不太擅长制作小图形,如果可能的话我想用 CSS 来做。是否涉及添加几个 div 无关紧要。

最佳答案

您可以添加以下 css:

ul li:hover {
border-bottom: 1px solid white;
margin-bottom: -1px;
}

因此,当您将鼠标悬停在菜单的 li 上时,白色边框会与容器 div 的蓝色边框重叠。

示例:http://jsbin.com/ujomi5/3

关于css - 自定义 horiz.menu CSS 底部边框技巧?需要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4712009/

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