I have this markup:
&开发者_如何学运维lt;dl class="item_tabs_details">
<dt>Lot Size</dt>
<dd>324 sq. meters</dd>
<dt>Baths</dt>
<dd>2</dd>
<dt>Full Description</dt>
<dd>
<p>
House & Lot for Sale/Rent, 4BR, 1165sqm. PHP65M/200K/MO. (Pasig) Beautiful
house with 4 bedrooms, den/office, entertainment room, covered lanai, swimming
pool and manicured garden.
</p>
</dd>
</dl>
using this style:
dl.item_tabs_details dt, dl.item_tabs_details dd{
float:left;
padding: 10px;
border-bottom: 1px solid #eee;
}
dl.item_tabs_details dt{
width:130px;
background-color: #ccc;
color: #000;
}
dl.item_tabs_details dd{
width:760px;
min-height: 12px;
}
if dd spans more than 1 line, I want the dt's height to be the same as the dd so that I can apply a background color to it without having some "holes".
There isn't an "easy CSS fix" here.
In this case, I would probably use a table
, because that does look somewhat like tabular data (and it makes solving your problem really easy).
http://jsfiddle.net/UvPGG/
<table class="item_tabs_details" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="row">Lot Size</th>
<td>324 sq. meters</td>
</tr>
<tr>
<th scope="row">Baths</th>
<td>2</td>
</tr>
<tr>
<th scope="row">Full Description</th>
<td>House & Lot for Sale/Rent, 4BR, 1165sqm. PHP65M/200K/MO. (Pasig) Beautiful house with 4 bedrooms, den/office, entertainment room, covered lanai, swimming pool and manicured garden.</td>
</tr>
</table>
.item_tabs_details {
width: 890px
}
.item_tabs_details td, .item_tabs_details th {
padding: 10px;
border-bottom: 1px solid #eee;
vertical-align: top
}
.item_tabs_details th {
width: 130px;
background: #ccc;
text-align: left;
font-weight: normal
}
精彩评论