Twitter bootstrap 在引导中使用推送或偏移哪个更好?
当我需要两列之间的空间时,使用Twitter bootstrap 在引导中使用推送或偏移哪个更好?,twitter-bootstrap,twitter-bootstrap-3,Twitter Bootstrap,Twitter Bootstrap 3,当我需要两列之间的空间时,使用offset或push哪个更好 HTML <div class="row"> <div class="col-md-2 col-md-offset-1">123 3456</div> <div class="col-md-2 col-md-offset-2">123 1234</div> </div> <div class="row "> <div c
offset
或push
哪个更好
HTML
<div class="row">
<div class="col-md-2 col-md-offset-1">123 3456</div>
<div class="col-md-2 col-md-offset-2">123 1234</div>
</div>
<div class="row ">
<div class="col-md-2 col-md-push-1">123 3456</div>
<div class="col-md-2 col-md-push-3">123 1234</div>
</div>
123 3456
123 1234
123 3456
123 1234
我想说,对于像您这样的基本操作,偏移量
要好得多。您应该仅使用推/拉
将块强制置于特定位置,而这是使用偏移
无法实现的
偏移量
在推/拉用户左
时使用左边距
,如果可以使用左边距
,则应避免使用该偏移量
因此,作为一个示例,最好使用以下方式:
<div style="margin-left: 8.33333%;"></div> // col-xs-offset-1
<div style="position: relative; left: 8.33333%;"></div> // col-xs-pull-1
在小型设备(sm)上,它看起来像:
Content A Content B
因此,如果要更改块的顺序,不能使用
offset
,只能使用pull/push
。因此,对于这种特殊情况,您应该使用pull/push
(当您想要更改块的顺序时),并且您应该使用offset
进行简单的操作,如您的示例所示。您能提供一个示例让我理解吗?无论设备是什么,我都需要空间,我不需要改变位置。所以偏移量更好,对吗?是的。偏移量是最好的。只有当您想拉回另一个元素时,才应使用push。(换位)
Content B
Content A
Content A Content B