Lot Size
3...">

Make dt and dd the same height to apply the background color on dt

I have this markup:

<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 row, I want the height of dt to be the same as dd so that I can apply a background color to it without any “holes”.

+3
source share
1 answer

There is no “simple CSS fix."

In this case, I would probably use it tablebecause it looks somewhat like tabular data (and this greatly simplifies the solution to your problem).

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 &amp; 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
}
+4
source

All Articles