使用bootstrap来粘贴容器右侧的按钮

时间:2013-11-20 09:48:20

标签: 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>

1 个答案:

答案 0 :(得分:0)

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

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

我认为你想使用pull-right而不是affix将按钮拉到右边。