如何更改我的选项卡使下面的内容缩进?

发布于 2024-11-28 11:53:58 字数 1391 浏览 2 评论 0原文

我的选项卡 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静谧 2024-12-05 11:53:58

#tabs 列表中的

  • 元素的位置为 top: -30px。但是,#tabs 的显示与 .content 一致。这似乎可以解决您的问题:
  • #tabs {
         margin: 0;
         padding: 0;
         margin-bottom: -35px;
         display: inline-block;
     }
    

    The <li> elements in your #tabs list has a position of top: -30px. However, #tabs is being displayed in line with the .content. This seems to fix your problem:

    #tabs {
         margin: 0;
         padding: 0;
         margin-bottom: -35px;
         display: inline-block;
     }
    
    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文