我正在学习创建一个响应式网站,并遇到了以下问题:我有两列(Col6)需要填充上一列(Col9)。col-9居中,我需要在Col-9中有两列(col-6)。HTML:
<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:
@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;
}是彼此之间的列太多还是一列太少?非常感谢您的帮助:)
发布于 2017-08-16 04:26:26
您可以使用Bootstrap使网页具有响应性。在Bootstrap中,代码如下所示:
<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中找到很多关于页面网格和制作响应式网页的有用的东西。
发布于 2017-08-16 04:29:19
听起来您想让这些列填满外部列的宽度?
.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;应该可以解决这个问题。
发布于 2017-08-16 17:14:25
我发现了问题:我的列容器放错了地方。我犯了个愚蠢的错误,无论如何,感谢大家的帮助!
https://stackoverflow.com/questions/45700799
复制相似问题