0
對於以下HTML,我希望容器包含section + content +元素,並且我希望element2是元素1的直接(float:left?)延續..高度問題:高度可變的內容自動? (jsFiddle)
<div class="page">
<div class="container">
<div class="section">
<div class="content">
<div class="element1">Elements Goes Here And Here And Here And Here .. more elements hereafter</div>
</div>
</div>
<div class="section">
<div class="content">
<div class="element1">Elements Goes Here And Here And Here And Here</div>
<div class="element2">more elements hereafter</div>
</div>
</div>
</div>
</div>
這個CSS不工作雖然http://jsfiddle.net/sLnY5/3/:
.container {
width: 100%;
min-height: 74px;
height: auto;
border: 1px solid rgba(142, 142, 142, 1);
}
.section {
width: 100%;
min-height: 37px;
height: auto;
border: 1px solid rgba(142, 142, 142, 1);
background-color: blue;
}
.content {
float: left;
min-height: 37px;
height: auto;
width: 100%;
line-height: 1.42;
padding: 2%;
border: 1px solid rgba(142, 142, 142, 1);
}
.element1 {
float: left;
font-size: 12.9px;
padding-top: 2px;
letter-spacing: 0.07em;
background-color: green;
}
.element2 {
float: left;
padding-left: 3px;
background-color: purple;
}
.page {
width: 50%;
height: auto;
margin: 0 auto;
padding-top: 5%;
}
完美,非常感謝 – StackThis
任何機會,你可以看看this..https://stackoverflow.com/questions/24496037/css-child2-variablewidth-based-on-child1-variablewidth- parent-max-width-jsfi似乎是另一種過度使用float ..無論如何,非常感謝 – StackThis