Html 在我的案例中,如何正确设置元素的边距
我试图使用引导程序在div中添加一堆元素 我有点像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 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
中的最佳实践。有人能帮我吗?谢谢 使用容器类
引导:
//内容
我的第一个应用//没有延伸
//伸展到边缘
//内容
//伸展到边缘
//内容
<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>