Html 在我的案例中,如何正确设置元素的边距

Html 在我的案例中,如何正确设置元素的边距,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我试图使用引导程序在div中添加一堆元素 我有点像 <div class="row"> <div class="col-xs-8"> //contents </div> <div id="forms" class="col-xs-4"> <div class="title">My first app</div> //no stretch <div

我试图使用引导程序在div中添加一堆元素

我有点像

<div class="row">
    <div class="col-xs-8">
       //contents
    </div>

    <div id="forms" class="col-xs-4">
        <div class="title">My first app</div> //no stretch 
        <div class="form-group">  //stretch to the edge
            //contents 
        </div>
        <div class="form-group"> //stretch to the edge
            //contents
        </div>
    </div>
</div>

//内容
我的第一个应用//没有延伸
//伸展到边缘
//内容
//伸展到边缘
//内容
我的问题是表单组有默认的
左边距:-15px
右边距:-15px
css。因此表单看起来非常延伸到
forms
div的边缘


我可以手动设置
margin:0
来覆盖这些表单的css,但我不确定这是否是
bootstrap
中的最佳实践。有人能帮我吗?谢谢

使用容器类

引导:

  • 容器
  • 其他地区(s)
  • 山坳(s)
  • 当你跳过一级时,你很可能被边缘卡住

    
    //内容
    我的第一个应用//没有延伸
    //伸展到边缘
    //内容
    //伸展到边缘
    //内容
    
    <div class="container">
     <div class="row">
        <div class="col-xs-8">
           //contents
        </div>
    
        <div id="forms" class="col-xs-4">
            <div class="title">My first app</div> //no stretch 
            <div class="form-group">  //stretch to the edge
                //contents 
            </div>
            <div class="form-group"> //stretch to the edge
                //contents
            </div>
        </div>
     </div>
    </div>