内联列表不是水平列出项目? [英] css list inline is not listing items horizontally?

查看:79
本文介绍了内联列表不是水平列出项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么这个显示不正确,列表是为了水平显示?
相反,它是垂直显示的!



这是我的代码:

  #stats li {display:inline; list-style-type:none; {code>< ul id = 0;};}} 统计 > <李> < H1> 53< / H1> < / A> < /锂> <李> < H1> 67< / H1> < / A> < / li>< / ul>  

解决方案


#stats li
{
display:inline;
list-style-type:none;
padding-right:20px;
float:left;
}

顺便提一句,您缺少开启 a 标记在您的HTML示例中。应该是

  
  • < a href =#>< h1> 53< h1>< / a>< / li>

  • I don't know why this is not displayed right, the list is meant to display horizontally? Instead it is displaying vertically!

    this is my code:

    #stats li {
      display: inline;
      list-style-type: none;
      padding-right: 20px;
    }

    <ul id="stats">
      <li>
        <h1>53</h1>
        </a>
      </li>
      <li>
        <h1>67</h1>
        </a>
      </li>
    </ul>

    解决方案

    You forgot to add float: left property to your CSS:

    
    #stats li
    {
      display: inline;
      list-style-type: none;
      padding-right: 20px;
      float: left;
    }
    

    By the way, you are missing opening a tag in your HTML example. Should be

    
    <li><a href="#"><h1>53</h1></a></li>
    

    这篇关于内联列表不是水平列出项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆