Reputation: 5671
The problem is when I try to set height: 20px
to all rows this breaks the natural width: 100%
from a block element. This bug only occurs on IE7 (tested on FF, Chrome and IE8).
HTML
<div id="container">
This must be adjusted to content
<div class="row">row 1</div>
<div class="row">row 2</div>
<div class="row">row 3</div>
<div class="row">row #</div>
</div>
CSS
#container {
border: 1px solid black;
position: absolute;
top: 10px;
left: 10px;
padding: 5px;
}
.row {
border: 1px solid blue;
margin-top: 2px;
height: 20px;
}
Demo
Notes
width: 100%
for rows is not an option.
Upvotes: 0
Views: 144
Reputation: 16269
Good to find a fellow country man :)
Just tested with "line-height: 20px;" instead of "height: 20px;" and worked just fine on:
Doc-Type used for this test was "strict".
Upvotes: 1
Reputation: 14505
This might not be the answer you're looking for (a table, ugh), but here goes...
<div id="container">
<table><tbody><tr><td>
This must be adjusted to content
<div class="row">row 1</div>
<div class="row">row 2</div>
<div class="row">row 3</div>
<div class="row">row #</div>
</td></tr></tbody></table>
</div>
I spent 1/2 an hour trying various combinations of hasLayout
and position: relative
and inline
/inline-block
etc, but a table was all I could get working I'm afraid :-(
Upvotes: 1