简体   繁体   English

WordPress问题上的Bootstrap流畅布局

[英]Bootstrap fluid layout on wordpress issue

Hi Is there any of you out there that is able to assist me on this. 嗨,有没有人可以在这方面为我提供帮助。 I'm experimenting with the fluid layout of bootstrap on my wordpress site. 我正在我的wordpress网站上尝试使用引导程序的流畅布局。 Apparently the isn't working properly. 显然,它无法正常工作。 I created a .span 12 column and its not taking up the full width of the browser. 我创建了一个.span 12列,它没有占用浏览器的整个宽度。 Instead its width shrank. 相反,它的宽度缩小了。 Is there a way around this? 有没有解决的办法?

Heres the experiment which i created using a custom page template 这是我使用自定义页面模板创建的实验

<?php
/*
Template Name: page-work
*/
?>
<?php get_header(); ?>    
<h1><?php the_title(); ?></h1>

<style type="text/css">

.span12{
    background:black;
    color:white;
    padding:20px 0;
    text-align:center;
    margin-top:15px;
}

.span6{
    background:blue;
    color:white;
    padding:20px 0;
    text-align:center;
        margin-top:15px;
}

</style>

<div class="container-fluid">

   <div class="row-fluid">

     <div class="span12">span 12</div>

</div>

   <div class="row-fluid">

     <div class="span6">span 6</div>
     <div class="span6">span 6</div>

   </div>

</div>

This is because bootstrap has a fixed width of span12 as 这是因为引导程序具有固定的span12宽度,例如

.span12 {
    width: 1170px;
  }

for bigger screens. 适用于更大的屏幕。

If you still want, you can try this: 如果仍然需要,可以尝试以下操作:

@media (min-width: 1200px) {
    .span12 {
        width: 100%;
    }
}

Always create a child css file and put that below the bootstrap file. 始终创建一个子css文件,并将其放在引导文件下方。

I would recommend upgrading to Bootstrap 3 as it handles fluid-containers in a much better way and you wouldn't have this problem in the first place. 我建议升级到Bootstrap 3,因为它可以更好地处理流体容器,而且您一开始就不会遇到这个问题。

.span12 becomes col-xx-12 (xx is either xs, sm, md and lg...read up on that!) and has a width of 100%. .span12变成col-xx-12(xx是xs,sm,md和lg ...请继续阅读!),宽度为100%。 BS3 uses percentage widths rather than fixed widths as mentioned in the answer above. BS3使用百分比宽度而不是上面答案中提到的固定宽度。 It's also not too difficult to move from BS2 to 3. 从BS2升级到3。

As a general rule, wordpress won't really change how your website looks. 通常,WordPress不会真正改变您网站的外观。 It's the styles you put around it so Wordpress in this case is irrelevant. 这是您放置的样式,因此Wordpress在这种情况下是无关紧要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM