我想要一个 4 列布局,但我不想指定我希望每个列在小、中和大分辨率下都是 3 个网格宽。我认为可能其中之一是默认设置,但我想每个人都认为它是默认设置是如此明显,以至于我还没有找到它的任何文档(或者我实际上必须指定吗?)。
如果有人可以提供任何提示,将不胜感激
最佳答案
Grid system: Introduction
- Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, [for example] applying any
.col-md-
class to an element will not only affect its styling on medium devices but also on large devices if a.col-lg-
class is not present.
另见 https://github.com/twbs/bootlint/wiki/E029 ,这是关于使用冗余网格类的相关错误:
For example, class="col-sm-6" will make the element 6 columns wide on small (sm), medium (md), and large (lg) screens. Therefore, class="col-sm-6 col-md-6 col-lg-6" and class="col-sm-6 col-md-6" are both equivalent to class="col-sm-6", which should be preferred since it's simpler and less verbose.
因此,如果您希望宽度适用于所有屏幕,请仅使用 col-xs-
。尽管通常使用 col-sm-
来代替,这样列会堆叠在 xs
屏幕上,由于 XS 屏幕太窄,这通常对用户更友好。
关于css - Bootstrap 3 : what's the default syntax for always be a certain grid size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26685056/