如何更改我的选项卡使下面的内容缩进?
我的选项卡 HTML 是:
<ul id = "tabs">
<li id = "home" onclick = "document.location.href = \'/\'">Home</a></li>
<li id = "games" onclick = "document.location.href = \'/games/\'">Games</li>
<li id = "tutorials" onclick = "document.location.href = \'/tutorials/\'">Tutorials</li>
<li id = "snippets" onclick = "document.location.href = \'/snippets/\'">Snippets</li>
<li id = "people" onclick = "document.location.href = \'/people.php\'">People</li>
</ul>
而它们的 CSS 是:
#tabs {
margin: 0;
padding: 0;
}
#tabs li {
display:inline;
float:left;
position:relative;
left:0px;
top:-30px;
padding: 9px;
padding-top: 2px;
padding-bottom: 2px;
margin-left: 5px;
border-top: 2px solid #03c;
border-left: 2px solid #03c;
border-right: 2px solid #03c;
border-top-right-radius: 3px;
-moz-border-top-right-radius: 3px;
border-top-left-radius: 3px;
-moz-border-top-left-radius: 3px;
background-color: #dddddd;
height: 24px;
font-family: trebuchet ms;
font-size: 20px;
font-weight: bold;
}
由于某种原因,在我的页面上,选项卡占用了下面的空间。看看我的意思这里。 是的,我知道有些链接无处可去。目前仍在设置中。
My HTML for the tabs is:
<ul id = "tabs">
<li id = "home" onclick = "document.location.href = \'/\'">Home</a></li>
<li id = "games" onclick = "document.location.href = \'/games/\'">Games</li>
<li id = "tutorials" onclick = "document.location.href = \'/tutorials/\'">Tutorials</li>
<li id = "snippets" onclick = "document.location.href = \'/snippets/\'">Snippets</li>
<li id = "people" onclick = "document.location.href = \'/people.php\'">People</li>
</ul>
And the CSS for them is:
#tabs {
margin: 0;
padding: 0;
}
#tabs li {
display:inline;
float:left;
position:relative;
left:0px;
top:-30px;
padding: 9px;
padding-top: 2px;
padding-bottom: 2px;
margin-left: 5px;
border-top: 2px solid #03c;
border-left: 2px solid #03c;
border-right: 2px solid #03c;
border-top-right-radius: 3px;
-moz-border-top-right-radius: 3px;
border-top-left-radius: 3px;
-moz-border-top-left-radius: 3px;
background-color: #dddddd;
height: 24px;
font-family: trebuchet ms;
font-size: 20px;
font-weight: bold;
}
And for some reason, on my pages, the tabs take up space in the things underneath. See what I mean here.
And yes, I know some links go to nowhere. It's still being set up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
#tabs
列表中的元素的位置为
top: -30px
。但是,#tabs
的显示与.content
一致。这似乎可以解决您的问题:The
<li>
elements in your#tabs
list has a position oftop: -30px
. However,#tabs
is being displayed in line with the.content
. This seems to fix your problem: