gpt4 book ai didi

html - 试图让菜单与 html 和 css 内联

转载 作者:行者123 更新时间:2023-11-28 06:04:00 25 4
gpt4 key购买 nike

我已经使用列表在 html 中创建了一个菜单列表,我已经将该列表添加到一个名为 menu 的 div 中。在我的 css 中,我添加了 display:inline 以尝试使列表以内联方式显示列表,通常这可行,但由于某种原因它似乎不起作用。

这是我的代码

#menu ul {
width: 100px;
position: absolute;
z-index: 1;
background: white;
padding-top: 20px;
margin: 0;
padding: 0;
list-style: none;
display: inline;
}
<div id="menu">

<ul>

<li><a href="index.php">Home</a>
</li>&nbsp; &nbsp; &nbsp;
<li><a href="about.php">About Us</a>
</li>&nbsp; &nbsp; &nbsp;
<li><a href="Specials.php">Specials</a>
</li>&nbsp; &nbsp; &nbsp;
<li><a href="terms.php">Terms</a>
</li>&nbsp; &nbsp; &nbsp;
<li><a href="contact.php">Contact Us</a>
</li>&nbsp; &nbsp; &nbsp;

</ul>

</div>

最佳答案

你需要在你的 ul li 而不是 ul 上放置内联显示,因为你只有一个 :)

因此,将您的 css 更改为:

    #menu ul li
{

width: 100px;
position: absolute;
z-index: 1;
background: white;
padding-top: 20px;
margin: 0;
padding: 0;
list-style:none;
display:inline;
}

关于html - 试图让菜单与 html 和 css 内联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36573902/

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