将div包裹在引导程序行内-而不是网格项? [英] Wrap div inside bootstrap row - not grid item?

查看:78
本文介绍了将div包裹在引导程序行内-而不是网格项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将div包裹在一行中?我知道这是可能的,但我只是想知道这是否是一个不好的做法.我在行内没有使用任何col-md类.

Is that possible to wrap div inside a row? I know it's possible but I just want to know it's a bad practice or not. I'm not using any col-md classes inside row.

请参见下面的示例.

<div class="row">
 <div class="home-bg">
  1
 </div>
</div>

推荐答案

这是一个不好的做法,因为.row仅用于包含网格col*,具体如

It's a bad practice because .row is only meant to contain grid col* as specifically stated in the Bootstrap docs...

行是列的包装.每列都有水平填充 (称为装订线)以控制它们之间的空间.这个填充 然后在具有负边距的行上抵消..在网格中 布局,必须将内容放置在列中,并且只能将列 行的直接子代.

Rows are wrappers for columns. Each column has horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins.. In a grid layout, content must be placed within columns and only columns may be immediate children of rows.

http://getbootstrap.com/docs/4.1/布局/网格/#how-it-works

这篇关于将div包裹在引导程序行内-而不是网格项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆