如何使这些按钮向右浮动并垂直对齐一些垂直间距

时间:2014-05-25 10:28:47

标签: javascript jquery html css twitter-bootstrap

以下是我的代码。

当前代码的按钮显示在底部,而我希望它们以垂直方式显示在最右边的位置。以下是我的代码

<div class= "container-fluid">
    <div class = "row">
        <div class = "col-sm-2">
        </div>

        <div class = "col-sm-8">
            <div name="visList">
                <div name="dispTestList">
                    <div class = "panel" >
                        <div class="panel-body">
                            <div class="row">
                                <div name="col-sm-2"><h4>ABC HEADING</h4>
                                </div>
                                <div name="col-sm-4">
                                    Desc1 : <span>Random Desc</span> | Desc 2 : 
                                    <span>Some Random</span> | Desc3 : <span>Random Desc</span> | Desc 4 : 
                                    <span>Some Random</span>
                                </div>
                                <div name="buttonSection" class="col-sm-6">
                                    <div class="pull-right">
                                        <a class = "btn btn-success" style="margin-top: 1%;">Take Test</a>
                                        <a class="btn btn-success">View Result</a>
                                        <a class="btn btn-success">View Answers</a>
                                    </div>
                                </div>
                            </div> <!-- Row -->
                        </div> <!-- Panel Body -->
                    </div> <!-- Panel -->

                </div>
            </div> <!-- visible the section -->
        </div> <!-- col-sm-8 -->

        <div class = "col-sm-2">
        </div>

    </div> <!-- Row -->
</div> <!-- container fluid -->

js小提琴就是这个http://jsfiddle.net/DashmeetSingh/k6EUK/

我希望按钮显示在下面的网页上。

http://www.starsports.com/cricket/tour/tourid=160/schedule/index.html

1 个答案:

答案 0 :(得分:0)

要将按钮对齐到右侧,请尝试:div.pull-right { float: right; }。如果您希望它们垂直堆叠,您也可以将按钮放在列表中。

<div class="pull-right">
    <ul class="buttons">
        <li><a class = "btn btn-success" style="margin-top: 1%;">Take Test</a></li>
        <li><a class="btn btn-success">View Result</a></li>
        <li><a class="btn btn-success">View Answers</a></li>
    </ul>
</div>

(要删除项目符号,您可以使用列表样式的速记CSS:ul.buttons { list-style: none }。)