【问题标题】:How to center a div with BlueprintCSS?如何使用 BlueprintCSS 使 div 居中?
【发布时间】:2013-08-14 18:52:38
【问题描述】:

所以我在容器类中有 div。如何使 div 居中,以便根据 div 的宽度正确地在两侧平等地添加空白空间?

<body>
  <div class="container">
    ... other stuff ...
    <div>center me</div>
  </div>
</body>

【问题讨论】:

    标签: blueprint-css


    【解决方案1】:

    你可以这样做:

    <div class="span-6 last prepend-9 append-9">contents</div>
    

    【讨论】:

      【解决方案2】:

      通常你知道跨度单位的页面宽度,因为你在构建你的 blueprint-css 文件时定义它们......所以你可以做这样的事情......“span-x”是段的宽度或跨度单位的页面...“left”向左浮动,“right”向右浮动...两者取消并居中 div。

      <body>
        <div class="container">
          ... other stuff ...
          <div class="span-x right left last">center me</div>
        </div>
      </body>
      

      【讨论】:

        【解决方案3】:

        蓝图有一个可以使用的“居中”样式:

        <div class="span-10 centered">...</div>
        

        【讨论】:

          【解决方案4】:

          老问题,我知道,但您可以将 divmargin-leftmargin-right 设置为 auto。我相信会做到的。

          【讨论】:

            猜你喜欢
            • 2012-03-12
            • 2012-10-25
            • 1970-01-01
            • 1970-01-01
            • 2011-11-22
            • 1970-01-01
            • 2015-09-12
            • 2017-02-21
            • 1970-01-01
            相关资源
            最近更新 更多