【问题标题】:Center Content Twitter Bootstrap中心内容 Twitter Bootstrap
【发布时间】:2013-10-12 21:02:54
【问题描述】:

我几乎在这里完成了我的网站:http://www.divisionforty.com/wall/,我已经到了剩下的最后一部分是让这个内容居中http://www.divisionforty.com/wall/artists/cali-balles/

代码如下:

<?php  get_header(); ?>
 <div class="row">
                <div class="span4">

                    <h2><a href="<?php  the_permalink()   ?>"><?php  the_title(); ?></a></h2>
                    <p>
<?php 

    if ( have_posts() ) :
    while ( have_posts() ) :
    the_post();
    ?>
    <div <?php  post_class()   ?> id="post-<?php  the_ID(); ?>">
            <?php  the_content(); ?>
    </div>
    <?php 
    endwhile;
    endif;
    ?>      </p>
        </div>
                    <div class="span8" id="thumbnails">
                        <?php  postimage($size=thumbnail, $qty=-1)    ?> 
                    </div>
</div>
<?php  get_footer(); ?>

该页面实际上没有任何样式自定义,因此它是基本的引导程序。

希望有人可以帮忙,

丹佛

为了澄清这是我想要的中心:

【问题讨论】:

标签: wordpress twitter-bootstrap responsive-design center html


【解决方案1】:

试试这个

  1. 从您的#wrap div 上取下max-width:1280px

  2. 在您的.row div 上将宽度设置为max-width:1200,将边距设置为margin:0 auto

  3. 您还可以将 text-align: center; 添加到您的 .row div 中,以便您的文本居中。

随着页面变小,这应该使您的内容居中。 (不太确定您要查找的内容。这将确保您的页眉一直穿过页面,同时将其下方的内容居中。)

【讨论】:

  • 我的意思是max-width:1200
  • @Denver 如果回答了您的问题,请将答案标记为已接受,否则请就未解决的问题提供反馈。谢谢
【解决方案2】:

创建一个新的容器类。

<div class="container_2">
  <div class="row">
     <div class="span4">
         ...
     </div>   
  </div>
</div>

在你的css中,添加这个

.container_2 {
  width: 1200px;  //you can change this.
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

}

【讨论】:

  • 似乎没有改变
  • 我检查了我们的网站并看到了更新的 html 代码,但没有 css 更新。无论如何,我对其进行了测试,它确实使您的 span4 和 span8 内容居中。你的问题是 span8 内容,不使用整个宽度,所以它看起来不像工作。
  • 考虑为 span8 内的图像嵌套一个 4 x span3,以便使用 span8 的整个宽度。
猜你喜欢
  • 1970-01-01
  • 2012-11-07
  • 2014-01-29
  • 1970-01-01
  • 2011-11-02
  • 2018-10-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多