【发布时间】:2018-12-11 18:59:03
【问题描述】:
我有一个关于在 Bootstrap 下使用容器的最佳方式是什么的问题。我有以下 4 个选项作为示例,我想知道哪种方法是使用容器的更好方法。差异只是风格而不是实质吗?指定类的顺序是否重要?如果是,最好的顺序是本地定义的第一个还是最后一个?
<!-- Latest JQuery; Must be loaded before Bootstrap -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.section-1
{
background-color: #2f5571;
font-size: 20px;
text-align: center;
color: #fdfcfc;
font-family: 'Lato', sans-serif;
padding: 20px 20px;
margin-top: 20px;
}
</style>
<div class="section-1">
<p>Some text 1</p>
</div>
<div class="section-1 container">
<p>Some text 2</p>
</div>
<div class="container section-1">
<p>Some text 3</p>
</div>
<div class="section-1">
<div class="container">
<p>Some text 4</p>
</div>
</div>
【问题讨论】:
-
为什么会有人反对这个?这是一个关于如何最有效和正确地使用 Bootstrap/CSS 的合理问题。事实上,关于使用 Bootstrap 容器的 SO 有 7,858 个问题...
-
你是什么意思?渲染? bootstrap 对渲染时间根本无效。
标签: css bootstrap-4 containers