【问题标题】:HTML navigation bar on right hand side of page页面右侧的 HTML 导航栏
【发布时间】:2014-11-10 21:13:23
【问题描述】:

我希望页面右侧的导航栏占用 250 像素,主要内容根据窗口大小占用剩余空间。虽然,我希望主要内容在 HTML 中的导航之前出现,所以左侧然后右侧。

我已经实现了左侧导航栏如下:

#left {
    float:left;
    width:250px;    
    background: blue;
}

#right {
    margin-left: 250px;
    background: orange;
}

http://jsfiddle.net/wz355dkr/

如何在不重新排序 HTML 的情况下将其移动到右侧?

【问题讨论】:

  • 你想要右侧的导航栏吗?

标签: html css


【解决方案1】:

    html,
    body,
    div {
      height: 100%;
    }
    #right {
      float: right;
      width: 250px;
      background: blue;
    }
    #left {
      background: orange;
      float: left;
    }
<div id="right">
  hello
</div>
<div id="left">
  Content in the left hand side.
</div>

【讨论】:

    【解决方案2】:

    只需在 css 中将 left 更改为 right

    html,
    body,
    div {
      height: 100%;
    }
    #left {
      float: right;
      width: 250px;
      background: blue;
    }
    #right {
      margin-right: 250px;
      background: orange;
    }
    <div id="left">
    </div>
    <div id="right">
    </div>

    【讨论】:

    • 我在此处进行了这些更改 - 右侧下拉?
    • @Sam 你遗漏了一些 CSS 规则并弄乱了 #right#left
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多