首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的两列不能填满顶部的列?

为什么我的两列不能填满顶部的列?
EN

Stack Overflow用户
提问于 2017-08-16 04:12:28
回答 3查看 40关注 0票数 0

我正在学习创建一个响应式网站,并遇到了以下问题:我有两列(Col6)需要填充上一列(Col9)。col-9居中,我需要在Col-9中有两列(col-6)。HTML:

代码语言:javascript
复制
<div class="row col-12 troeven-0"> 
<div class="col-container col-9 col-center-block troeven-1"> 
<div class="colom col-6 goedkoop">
 <h2 class="troeven">
   GOEDKOOP
 </h2>
 <img src="goedkoop.jpg" width="400" height="155" alt="goedkoop" />
 </div>
  <div class="colom col-6 responsive">
 <h2 class="troeven">
   RESPONSIVE
  </h2>
 <img src="goedkoop.jpg" width="400" height="155" alt="goedkoop" />
 </div>
 </div> 
</div>

CSS:

代码语言:javascript
复制
@media only screen and (min-width: 768px) {
/* For desktop: op PC (of bij een minimum van 768px hebben alle kolommen onderstaande breedte*/
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}
}

.troeven-0 {
 height: auto;
 }

 .troeven-1 {
  height: auto;
  padding: 0px;
   }

 .goedkoop {
  height: auto;
  text-align: center;
  padding: 30px;
  background: red;
   }

 .responsive {
  height: auto;
  text-align: center;
  padding: 30px;
  background: blue;
  }

是彼此之间的列太多还是一列太少?非常感谢您的帮助:)

EN

回答 3

Stack Overflow用户

发布于 2017-08-16 04:26:26

您可以使用Bootstrap使网页具有响应性。在Bootstrap中,代码如下所示:

代码语言:javascript
复制
<div class="row">
    <div class="col-md-12">
        <div class="row">
            <div class="col-md-9 col-md-offset-3">
                <div class="row">
                    <div class="col-md-6">
                        <h2 class="troeven">
                            GOEDKOOP
                        </h2>
                        <img src="goedkoop.jpg" width="400" height="155" alt="goedkoop"/>
                    </div>
                    <div class="col-md-6">
                        <h2 class="troeven">
                            RESPONSIVE
                        </h2>
                        <img src="goedkoop.jpg" width="400" height="155" alt="goedkoop"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

你可以在this link的Bootstrap中找到很多关于页面网格和制作响应式网页的有用的东西。

票数 0
EN

Stack Overflow用户

发布于 2017-08-16 04:29:19

听起来您想让这些列填满外部列的宽度?

代码语言:javascript
复制
  .goedkoop {
    height: auto;
    text-align: center;
    padding: 30px;
    background: red;
    margin: auto;
    text-align: center;
 }

 .responsive {
    height: auto;
    text-align: center;
    padding: 30px;
    background: blue;
    margin: auto;
    text-align: center;
}

添加空白区: auto;和text-align: center;应该可以解决这个问题。

票数 0
EN

Stack Overflow用户

发布于 2017-08-16 17:14:25

我发现了问题:我的列容器放错了地方。我犯了个愚蠢的错误,无论如何,感谢大家的帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45700799

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档