【发布时间】:2014-02-28 06:27:00
【问题描述】:
我正在为我的主页制作显示器。我在一个容器中创建了五个 col-md-2,并将列的大小调整为我需要的宽度。调整它们的大小很容易,但现在我遇到了一个问题。而不是这些列都等于占据了容器总宽度的 83.3%,在调整它们的大小之后,它们现在总共占据了容器的 116%。其中一些列的边距彼此重叠一点,但仍然会有一些额外的空间需要在左侧和右侧溢出容器。我可以让最左边的列溢出容器之外,但我很难让最右边的列溢出。任何时候最右边(蓝色)的 div 太大而无法容纳在内联空间中,它就会被向下推。有谁知道我如何强制蓝色 div 溢出容器的右侧,而不是被推下?我尝试使用溢出属性,但没有任何运气=。我想将左右溢出设置为隐藏,但任何溢出暂时都可以!
HTML:
<div class="date-con">
<div class="col-md-2 green">
</div>
<div class="col-md-2 white-left">
</div>
<div class="col-md-2 red">
</div>
<div class="col-md-2 white-right">
</div>
<div class="col-md-2 blue">
</div>
</div>
CSS:
.date-con {
width: 75%;
height: 250px;
background-color: lightpink;
border: 1px solid black;
margin: 0 auto;
}
.date-con .green {
width: 24.5%;
height: 200px;
background-color: green;
margin-left: -1.5%;
position: relative;
z-index: 100;
display: inline-block;
}
.date-con .white-left {
width: 19.83333333333333%;
height: 150px;
background-color: #E8E8E8;
margin-left: -3.1%;
position: relative;
display: inline-block;
z-index: 10;
}
.date-con .red {
width: 23.66666666666667%;
height: 200px;
background-color: red;
margin-left: -3.1%;
position: relative;
display: inline-block;
z-index: 100;
}
.date-con .white-right {
width: 23%;
height: 150px;
background-color: #E8E8E8;
margin-left: -3.6%;
position: relative;
display: inline-block;
z-index: 10;
}
.date-con .blue {
width: 25.41666666666667%;
height: 200px;
background-color: blue;
margin-left: -3.5%;
margin-top: 50px;
position: relative;
display: inline-block;
z-index: 10;
}
这是我的靴子:
【问题讨论】:
标签: html css twitter-bootstrap twitter-bootstrap-3 overflow