gpt4 book ai didi

html - 为什么我的子子列表不显示内联?

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

我在让我的子子列表内联显示时遇到了麻烦。我尝试了很多无助于解决问题的方法。

<header>
<nav class="nav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="services.html">Services</a>
<ul>
<li><a href="addiction.html"> Drug and addiction consoling</a></li>
<li><a href="life.html"> Life coaching</a></li>
</ul>
</li>
<li><a href="articles.html">Articles</a>
<ul>
<li><a href="famlies.html">Addiction and famlies</a></li>
<li><a href="steps.html">What is the first step?</a>
<ul>
<li><a href="one.html"><span>Step 1</span></a></li>
<li><a href="two.html"><span>Step 2</span></a></li>
<li><a href="three.html"><span>Step 3</span></a></li>
</ul>
</li>
<li><a href="religion.html">Relgion and breaking addition</a></li>
</ul>
</li>
<li><a href="inspiration.html">Inspiration</a></li>
</ul>
</nav>
</header>

这是我的CSS

body
{
background-color: #ff9900;
font-family: 'Merriweather', serif;
width: 100%;
margin: 0 auto;
}

header
{
text-align: center;
width: 100%;
background: rgb(116, 206, 126);
display: nowrap;
margin-bottom: 10px;
}

nav ul ul
{
display: none;
}

nav ul li:hover > ul
{
display: block;
}

nav ul
{
padding: 0;
border-radius: 0px;
list-style: none;
position: relative;
display: inline-table;

}

nav ul:after
{
display: inline-block;

}

nav ul li
{
float: left;

}

nav ul li:hover
{
background-color: #6559ff;
border-radius: 10px;
-webkit-transition: background-color 500ms ease-out;
-moz-transition: background-color 500ms ease-out;
-o-transition: background-color 500ms ease-out;
transition: background-color 500ms ease-out;
}

nav ul li:hover a
{
color: #fff;

}

nav ul li a
{
display: block;
padding: 10px 70px;
color: #000080;
text-decoration: none;
-webkit-transition: background-color 500ms ease-out;
}

nav ul ul
{
background: #5f6975;
border-radius: 0px;
position: absolute;
top: 100%; /*wat?*/
padding: 0;
text-align: left;
}

nav ul ul li
{
float: none;/*wat?*/
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
padding: 0;
text-align: left;
}

nav ul ul li a
{
color: #fff;
padding: 15px;
}

nav ul ul li a:hover
{
background-color: #f2f2f2;
padding: 15px;
color: #000000;
}

nav ul ul ul
{
position: absolute;
left: 100%;
top:0;
}

我意识到这看起来一团糟。这是一个 jsfiddle.非常感谢您的帮助。感谢您的时间和考虑。

最佳答案

如我所见,如果我正确理解问题:

nav ul li a {
clear: none;
float: left;
display: inline;
}

参见 fiddle -> http://jsfiddle.net/Pvtqu/

关于html - 为什么我的子子列表不显示内联?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22135848/

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