【发布时间】:2015-03-19 17:13:43
【问题描述】:
我无法制作一个有 5 列和流体宽度/高度的垂直条。我想要的是当页面缩小时高度增加,所以每列中的文本仍然在栏中。
这就是我应该的样子和我所拥有的:
现在,如果我的屏幕变小,文本会出现在栏之外,这不是我想要的。我也不能得到相等的列宽。有 5 列应该等于 100% 宽度,但每列 20% 不起作用。
HTML:
<div id="wizard-steps">
<div class="wizard-header float-left">Kaderings analyseaanvraag</div>
<div class="wizard-header float-left">Specificaties analyses : Type staal/stalen</div>
<div class="wizard-header float-left">Specificaties analyses : Te bepalen componenten</div>
<div class="wizard-header float-left">Specificaties analyses : Tijdschema en aantal stalen</div>
<div class="wizard-header float-left">Data-analyse</div>
</div>
CSS:
#wizard-steps {
border-radius: 3px;
border: 2px solid #a2c61c;
width: 100%;
height: 20px;
margin: 0 auto;
position: relative;
}
#wizard-steps div {
border-right: 2px solid #a2c61c;
width: 19%;
height: 20px;
text-align: center;
cursor: pointer;
float: left;
}
#wizard-steps div:last-child {
border: white;
}
.active-step {
background-color: #a2c61c;
color: white;
}
任何帮助将不胜感激!
更新的 CSS:(感谢 Ruddy & panther)
#wizard-steps {
border-radius: 3px;
border: 2px solid #a2c61c;
width: 100%;
display: table;
}
#wizard-steps div {
border-right: 2px solid #a2c61c;
width: 19%;
text-align: center;
cursor: pointer;
display: table-cell;
}
#wizard-steps div:last-child {
border: white;
}
.active-step {
background-color: #a2c61c;
color: white;
}
这让我明白了:
是否有可能修复它增长时,活动步骤背景也应该增长?由于 19%,我在右边还有一个小专栏。
【问题讨论】:
-
这样的? Demo
-
这正是我想要的@Ruddy
标签: html css multiple-columns fluid-layout