BootStrap网格问题与固定容器

时间:2014-01-15 11:47:41

标签: html css twitter-bootstrap grid width

我正在使用bootstrap编写我的视图,我在视图中有以下代码,the container will be a fixed value of 980pxnavbar should have a width of 242px,但现在导航栏的宽度是由bootstrap自动计算的,宽度为245px。

有没有办法进行自定义以使导航栏的固定宽度为242px?     

    <div class="row" >
        <div id="navbar" class="col-sm-3  col-lg-3  navbar">             

        </div>
        <div class="col-sm-9  col-lg-9  content">
            content
            <!-- insert nested grid here -->
        </div>          
    </div>      
</div>

2 个答案:

答案 0 :(得分:2)

替换它: -

<div id="navbar" class="col-sm-3  col-lg-3  navbar">

有了这个: -

<div id="navbar" class="navbar">

.navbar{
width: 242px;
}

答案 1 :(得分:1)

试试这个

<div class="row" >
            <div id="navbar" class="col-sm-3  col-lg-3  navbar" style="width:242px;">             

            </div>
            <div class="col-sm-9  col-lg-9  content">
                content
                <!-- insert nested grid here -->
            </div>          
        </div>      
    </div>