1
我已經嘗試了很多東西,但無法獲得所需的格式。 HTML:定位其中的div和span文本
<div class="usertype">
<div class="type1">
<span class="type-heading">type1 is here</span>
<span class="type-description">10 types have joined</span>
<span class="type-description">35 type will.</span>
</div>
<div class="type2">
<span class="type-heading">type2 is here</span>
<span class="type-description">10 types are there</span>
<span class="type-description">35 type will.</span>
</div>
<div class="type1">
<span class="type-heading">type23 is good</span>
<span class="type-description">50 types are there</span>
<span class="type-description">50 types are there</span>
<span class="type-description">for 2 months</span>
</div>
<div class="type2">
<span class="type-heading">Type4 at last</span>
<span class="type-description">50 types are there</span>
<span class="type-description">makes their first $20</span>
<span class="type-description">50 types are there</span>
<span class="type-description">35 type will.</span>
</div>
</div>
CSS:
div.usertype {
margin-top: 1em;
}
div.type1 {
float: left;
margin-left: 2em;
}
span.type-heading {
font-size: 14px;
color: #f7f7f7;
}
span.type-description {
font-size: 14px;
color:#959595;
display: block;
}
輸出:
我想要什麼:
- 減小跨度之間的垂直距離與
type-description
類。我嘗試使用line-height
和padding-bottom
,但無法移動它。可能是一些父div有display:block
。 - 所有類型描述都與現在居中的左側對齊。如果我用它
float: left
,它完全破壞了格式。
請幫忙。
好像你遺漏了一些CSS。重現此操作不會生成您發佈的示例圖片。 – j08691 2013-03-24 02:58:57
你的意思是這樣的嗎? http://jsfiddle.net/WfdLN/ – kufudo 2013-03-24 03:00:55