css - 使用 Bootstrap 在容器右侧添加按钮

标签 css twitter-bootstrap-3

我正在尝试使用 bootstrap 3 的词缀。

它工作正常,但我需要将按钮附加到容器而不是窗口。

我面临的问题是当我按 Ctrl-- 缩小屏幕尺寸按钮时,它会粘在窗口右侧。(在大屏幕上面临问题)

我怎样才能将按钮固定在容器的右侧。所以当屏幕尺寸变大时它会显示在容器的右侧。

这是链接:Fiddle link

.save-btn .affix {
  top: 100px;
  right: 0px;

}
.container {
    border: 1px solid #ccc;
}



<div class="container">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" role="form">
                <div class="form-group">
                    <label for="exampleInputEmail1">Email address</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">Password</label>
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                </div>
                <div class="form-group">
                    <label for="exampleInputFile">File input</label>
                    <input type="file" id="exampleInputFile">
                    <p class="help-block">Example block-level help text here.</p>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox"> Check me out
                    </label>
                </div>
                <div class="save-btn">
                    <button name="submit" type="submit" value="Save" class="btn   btn-orange btn-lg affix" data-spy="affix" data-offset-top="0">Save </button>
                </div>
            </form>
        </div>
    </div>
</div>

最佳答案

jsfiddle 使用的是 BS 2.x,但您的标记适用于 Bootstrap 3。

我创建了一个 Bootply(自动包含 BS 3):http://www.bootply.com/95296

我认为您想使用 pull-right 而不是 affix 将按钮向右拉。

关于css - 使用 Bootstrap 在容器右侧添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20092426/

相关文章:

javascript - 悬停时更改链接/按钮的背景颜色

html - <A> 中的换行符不起作用

php - 如何在 PHP 上调用点击按钮

html - 无法调整 bootstrap 3 框的大小以适合图像

javascript - 为什么我的 Bootstrap 3 轮播出现这种行为?

html - Bootstrap 3 网格系统。嵌套的行和列

javascript - BootstrapDialog.alert() 未显示

Javascript:无法在 div 标签上加载图像资源

javascript - 在没有 javascript 的情况下重新排序 "stacks"/列之间的 Bootstrap 元素

html - 为什么我的导航栏没有覆盖整个屏幕?