关于Bootstrap 3响应面板设置宽度的问题

时间:2014-06-18 14:16:30

标签: twitter-bootstrap twitter-bootstrap-3

请你看看This Demo,让我知道为什么小组的标题表现得像演示(从左和右获得边距)? 正如我在帖子标题中提到的,我正在尝试创建一个响应式面板,因此righttoc-->panel panel-default-->类似表单中的所有元素也表现出响应

<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2 col-sx-12" id="lefttoc">Left</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-sx-12" id="maptoc">Center</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-sx-12" id="righttoc">
 <div class="panel panel-default col-lg-10 col-md-11 col-sm-2 col-sx-12 ">
  <div class="panel-heading">
    <h3 class="panel-title">Panel title</h3>
  </div>
  <div class="panel-body">
    Panel content
  </div>
</div>
</div>
</div><!-- End of Row -->

由于

1 个答案:

答案 0 :(得分:11)

问题主要在于您已嵌套列而不在其间添加所需的行元素。行上有负边距可以解决您的问题。

请改为尝试:

<div class="row">
    <div class="col-sm-2 col-xs-12" id="lefttoc">Left</div>
    <div class="col-sm-7 col-xs-12" id="maptoc">Center</div>
    <div class="col-sm-3 col-xs-12" id="righttoc">
        <div class="row">
            <div class="col-lg-10 col-md-11 col-sm-2 col-xs-12">
                <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>
            </div>
        </div><!-- End of Row -->
    </div>
</div><!-- End of Row -->