引导行中的左,中,右三个按钮

时间:2017-08-15 04:07:11

标签: html css twitter-bootstrap-3

我目前正试图将三个按钮放在容器内。我已经非常接近,但我似乎无法将所有按钮保持在一排。我试过了文字 - [左,右,中]以及拉 - [左,右]。

我已经包含了一个骨架shell来提供基本布局。

<!DOCTYPE html>
<html>
    <head>
        <!-- meta -->

        <!-- refs -->
        <link rel="stylesheet" type="text/css" href="style.css">

        <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <!-- scripts -->

        <title>The title</title>
    </head>
    <body>



<!-- MASTER CONTAINER -->
<div class="container-fluid page-container">

    <!-- divide main content into three sections left, middle, right -->
    <!-- top section container -->
    <div class="row top-container">
        <!-- top section -->
        <div class="col-sm-12">

        </div>
    </div>

    <div class="row">
        <!-- LEFT CONTAINER (vertical)       -->
        <!-- left side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Save Trick</button>
        </div

        <!-- right side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div>




        <div class="col-sm-8">
            <!-- MIDDLE CONTAINER (horizontal)  -->
            <div class="middle-container">
                <div class="middle-top">
                    <button class="btn btn-default" type="button">Approach</button>
                    <button class="btn btn-default" type="button">Street/Half Pipe</button>
                    <button class="btn btn-default" type="button">Coach Assisted</button>
                </div>

                <div class="middle-video">
    4
                </div>

                <div class="middle-textinput">
    5
                </div>

                <div class="middle-bottom">
    6
                </div>
            </div>
        </div>


        <!-- RIGHT CONTAINER (vertical)     -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div

        <!-- right side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div>

        </div>

    </div>
</div>


    </body>
</html>

Style.css(显示框模型)

* {
    border: 1px solid black;
    margin: 0;
    padding: 0;
}

任何提示都将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试这个最简单的解决方案

HTML

<!DOCTYPE html>
<html>
    <head>
        <!-- meta -->

        <!-- refs -->
        <link rel="stylesheet" type="text/css" href="style.css">

        <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <!-- scripts -->

        <title>The title</title>
    </head>
    <body>



<!-- MASTER CONTAINER -->
<div class="container-fluid page-container">

    <!-- divide main content into three sections left, middle, right -->
    <!-- top section container -->
    <div class="row top-container">
        <!-- top section -->
        <div class="col-sm-12">

        </div>
    </div>

    <div class="row">
        <!-- LEFT CONTAINER (vertical)       -->
        <!-- left side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Save Trick</button>
        </div

        <!-- right side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div>




        <div class="col-sm-8">
            <!-- MIDDLE CONTAINER (horizontal)  -->
            <div class="middle-container">
                <div class="middle-top"><center>
                    <button class="btn btn-default" type="button">Approach</button>
                    <button class="btn btn-default" type="button">Street/Half Pipe</button>
                    <button class="btn btn-default" type="button">Coach Assisted</button></center>
                </div>

                <div class="middle-video">
    4
                </div>

                <div class="middle-textinput">
    5
                </div>

                <div class="middle-bottom">
    6
                </div>
            </div>
        </div>


        <!-- RIGHT CONTAINER (vertical)     -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div

        <!-- right side -->
        <div class="col-sm-1">
            <button class="btn btn-default btn-block" type="button">Gold</button>
            <button class="btn btn-default btn-block" type="button">Black</button>
            <button class="btn btn-default btn-block" type="button">Blue</button>
            <button class="btn btn-default btn-block" type="button">Green</button>
            <button class="btn btn-default btn-block" type="button">White</button>
        </div>

        </div>

    </div>
</div>


    </body>
</html>