【问题标题】:If I use "position:fixed;" can I have the position be on the right?如果我使用“位置:固定;”我可以让位置在右边吗?
【发布时间】:2014-08-15 04:38:35
【问题描述】:

使用“位置:固定;”时在我的样式表中,我的位置也可以在右边吗?这是我的代码:

CSS

.buttons {
    margin-bottom: 30px;
    text-align: right;
    position:fixed;
}

HTML

<div id="main">
    <div class="container">
        <div class="buttons">
                <button class="nav-toggler toggle-slide-left">Menu</button>
            </div>
        </div>
    </div>

【问题讨论】:

  • 你没试过吗?
  • 你在请求许可吗?

标签: html css position fixed


【解决方案1】:

是的,你只需要加上'right: 0;'到你的 .buttons CSS 类。

【讨论】:

【解决方案2】:

DEMO

<div id="main">
    <div class="container">
        <div class="buttons">
                <button class="nav-toggler toggle-slide-left">Menu</button>
            </div>
        </div>
    </div>
.buttons {
    margin-bottom: 30px;
    text-align: right;
    position:fixed;
    right:0px;//add this
}

【讨论】:

    猜你喜欢
    • 2011-06-16
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2010-12-14
    • 2021-11-11
    • 2018-11-28
    • 1970-01-01
    • 2017-11-08
    相关资源
    最近更新 更多