html - 您将如何修复显示为列表的导航栏?

标签 html css

当我尝试制作导航栏时,我希望它向右浮动,但是当我这样做时,

  • 元素在我希望它们水平显示时垂直显示。

    #navigation ul{
      font-family: 'Roboto', sans-serif;
      float: right;
      overflow: hidden;
      line-height: 1px !important;
      /*position: fixed;*/
    }
    #navigation ul li h3 {
      font-weight: normal;
      font-size: 34px !important;
      color: #000;
      margin-right: auto;
      padding: 0;
      margin: auto;
      letter-spacing: 0.25px;
    }
    #navigation ul li {
      list-style: none;
      line-height: 40px !important;
    }
    #navigation a{
      text-align: center;
    }
    <header>
          <nav id="navigation">
            <ul>
              <li>
                <a href="./entry.html"><h3>Home</h3></a>
                <a href="#"><h3>About</h3></a>
                <a href="#"><h3>Timeline</h3></a>
                <a href="#"><h3>Video</h3></a>
              </li>
            </ul>
          </nav>
        </header>

  • 最佳答案

    尝试插入一个显示:inline;在元素上。

    #navigation ul li h3 {
     font-weight: normal;
     font-size: 34px !important;
     color: #000;
     margin-right: auto;
     float:right;
     padding: 0;
     margin: auto;
     letter-spacing: 0.25px;
     display:inline;
    

    关于html - 您将如何修复显示为列表的导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54714189/

    相关文章:

    javascript - jQuery 如何刷新附加的 div 的特征?

    html - 需要使用 CSS 增加框的宽度,但更改宽度和长度没有效果

    javascript - 在 javascript : null error 中设置 z-index

    javascript - 当屏幕分辨率低于 600px 时无法隐藏 <a> 标签

    css - 如何在 <img> 标签中使用 CSS background-attachment?

    css - IE CSS 悬停问题与 Facebook/Twitter/+1 按钮

    jquery - 内容可编辑的问题

    html - Uncaught SyntaxError : Unexpected token < in HTML - can't solve

    javascript - 使用 Css 或 Jquery 隐藏 Span 的第一个单词

    CSS !important 不优先?