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

标签 html css inline

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

<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/

相关文章:

javascript - 将父项应用于 iframe

angularjs - 如何在不相同的情况下显示相同尺寸的图像

c++ - 内联函数的概念是什么以及它与宏有何不同?

c - 使用全局 C 变量的 IAR 内联汇编

css - IE 中的 Contenteditable 内联样式

javascript - html:基于电子邮件的价格列表

html - 当屏幕分辨率减小时,Bootstrap Asp.net Web 表单页面没有响应

html - CSS 转换在 Internet Explorer 7 及以下版本中不起作用

html - 带文本的主干圆旋转

javascript - 自动刷新图片在 IE 版本 9 中不起作用