我有这个沙龙列表,每个沙龙的右手边都有一个虚线边框。其中一些边界在其他边界之前停止,有什么方法可以使它们的长度相同吗?(理想情况下它们会到达页脚)所有沙龙都在这个HTML中(信息只是不同):
<div class="salons">
<h1><a href="salonpage.php?salonid=1">Urban Bliss</a></h1>
<p> 15 Headingly Lane,
LS6 1BL.
0113 278 1572</p>
</div>CSS如下:
.salons {
font-family:"Century Gothic";
width:248.5px;
max-height:inherit;
float:left;
padding-left:5px;
border-right:1px dotted #FFB6D7;
padding-bottom:5px;
}

发布于 2013-12-18 22:34:58
好的,你需要给它的父元素一个固定的大小,最长的一个,然后将height: 100%;添加到子元素中。
.parent {
width: 100%;
height: 190px;
}
.salons{
font-family:"Century Gothic";
width:248.5px;
height:100%;
float:left; /* the reason the parent needs a fixed height is due to the float */
padding-left:5px;
border-right:1px dotted #FFB6D7;
padding-bottom:5px;
}JSFIDDLE
发布于 2013-12-18 22:34:13
发生这种情况的原因是因为一些盒子的高度低于最高的盒子高度。要解决这个问题,只需将固定高度添加到css中的所有div即可。例如:
height:200px;发布于 2013-12-18 22:36:12
这是因为它们有不同的height (基于它的内容)…
您可以尝试为.salons class指定固定的高度
或者..。
100%和容器的固定高度。
https://stackoverflow.com/questions/20660746
复制相似问题