Twitter 引导容器 [英] Twitter Bootstrap Containers

查看:50
本文介绍了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 引导容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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