如何更改bootstrap列的宽度

时间:2014-05-07 16:09:11

标签: html css css3 twitter-bootstrap twitter-bootstrap-3

如何展开顶部面板(标记为红色)以便覆盖整个页面宽度(标记为绿色)? 所有都必须具有相同的宽度。

第二个类似的问题。 我需要在bootom中添加第7个表。怎么做,所以它们都有相同的宽度?

enter image description here

在线演示:bootply

我的代码在这里:

<div class="container-full">
    <div class="row clearfix">
        <div class="col-md-3 column well">
            <h2>
                Heading
            </h2>
            <p>
                Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
            </p>
            <p>
                <a class="btn" href="#">View details »</a>
            </p>
        </div>
        <div class="col-md-9 column">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <div class="row clearfix">
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                        </div>
                        <div class="col-md-1 column">
                        </div>
                        <div class="col-md-1 column">
                        </div>
                    </div>
                    <div class="row clearfix">
                        <div class="col-md-1 column">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        Panel title
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    Panel content
                                </div>
                                <div class="panel-footer">
                                    Panel footer
                                </div>
                            </div>
                        </div>
                        <div class="col-md-1 column">
                        </div>
                        <div class="col-md-1 column">
                        </div>
                        <div class="col-md-1 column">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="row clearfix">
                <div class="col-md-2 column">
                    <table class="table table-bordered table-condensed">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-2 column">
                    <table class="table table-bordered table-condensed">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-2 column">
                    <table class="table table-condensed table-bordered">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-2 column">
                    <table class="table table-condensed table-bordered">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-2 column">
                    <table class="table table-condensed table-bordered">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-2 column">
                    <table class="table table-condensed table-bordered">
                        <thead>
                            <tr>
                                <th>
                                    #
                                </th>
                                <th>
                                    Product
                                </th>
                                <th>
                                    Payment Taken
                                </th>
                                <th>
                                    Status
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Default
                                </td>
                            </tr>
                            <tr class="active">
                                <td>
                                    1
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    01/04/2012
                                </td>
                                <td>
                                    Approved
                                </td>
                            </tr>
                            <tr class="success">
                                <td>
                                    2
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    02/04/2012
                                </td>
                                <td>
                                    Declined
                                </td>
                            </tr>
                            <tr class="warning">
                                <td>
                                    3
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    03/04/2012
                                </td>
                                <td>
                                    Pending
                                </td>
                            </tr>
                            <tr class="danger">
                                <td>
                                    4
                                </td>
                                <td>
                                    TB - Monthly
                                </td>
                                <td>
                                    04/04/2012
                                </td>
                                <td>
                                    Call in to confirm
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

4 个答案:

答案 0 :(得分:6)

如果你有9个col-md-1列,那就不可能了,因为它们不能被12分(网格系统有12个部分)。

但是,您可以使用3个col-md-4附加包装器,并在每个包装盒中放置3个col-md-4列,这样可以为您提供所要求的结果。

类似的东西:

 <div class="container-full">
         <div class="row clearfix">
    <div class="col-md-3 column well">
        <h2>
            Heading
        </h2>
        <p>
            Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
            <a class="btn" href="#">View details »</a>
        </p>
    </div>
    <div class="col-md-9 column">

        <div class="col-md-4">
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
        </div>

        <div class="col-md-4">
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
        </div>

        <div class="col-md-4">
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
            <div class="col-md-4">
                ...content...
            </div>
        </div>

    </div>
</div>

编辑:修正拼写错误到包装器col-md-3 =&gt; COL-MD-4

答案 1 :(得分:5)

我必须在RARE场合这样做......但是在必要时,它可以帮助......但无论如何,你可以创建一个自定义网格定义,这样你就可以有一个7列网格:

<div class='row grid7'>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
    <div class='col-md-1'>1/7th</div>
</div>

然后,一些CSS使它工作:

.grid7 .col-md-1 { width: 14.285714285714%; }
.grid7 .col-md-2 { width: 28.571428571429%; }
.grid7 .col-md-3 { width: 42.857142857143%; }
.grid7 .col-md-4 { width: 57.142857142857%; }
.grid7 .col-md-5 { width: 71.428571428571%; }
.grid7 .col-md-6 { width: 85.714285714286%; }
.grid7 .col-md-7 { width: 100%; }

答案 2 :(得分:2)

这可能会有所帮助 https://github.com/drew-r/bootstrap-n-column 您可以使用LESS

创建n列引导程序布局

答案 3 :(得分:1)

您可以在引导程序中使用 col-fluid 代替,然后使用CSS指定其宽度

HTML

<div class="row">
        <div class="col-fluid sidebar">
           <a href="#">log in</a>
           <a href="#">sign up</a>
        </div>
</div>

CSS

.sidebar{
    padding-left: 0px;
    background-color: #1f1f1f;
    min-height: 100vmin;
    width: 200px;
}