Twitter Bootstrap Containers(Twitter 引导容器)
问题描述
我已经使用 bootstrap 几个月了,我希望澄清一些作为最佳实践的一部分.
Ive been using bootstrap for a few months and am looking to clarify something as part of best practices.
我的问题是我是为每一行创建一个容器,还是为整个页面创建一个大容器.
My question is do I create a container for each row or just one big container for the whole page.
示例 1(封闭容器)
<div class="container">
<div class="row">
<div class="span8 offest2">
<h1>Content</h1>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span8 offest2">
<h1>More Content</h1>
</div>
</div>
</div>
示例 2(1 个大容器)
Example 2 (1 large container)
<div class="container">
<div class="row">
<div class="span8 offest2">
<h1>Content</h1>
</div>
</div>
<div class="row">
<div class="span8 offest2">
<h1>Content</h1>
</div>
</div>
</div>
感谢任何帮助,只是不想早早养成坏习惯
Any help appreciated, just dont want to get into bad habits early on
推荐答案
我会推荐第二个例子.首先,您有重复的代码,这没有任何意义.始终考虑不要重复自己"的原则.
I would recommend the second example. In the first you have duplicate code wich makes no real sense. Always think about the principle "Don't repeat yourself".
这篇关于Twitter 引导容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Twitter 引导容器


- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01