Initial public release
Escapes test corrected (credit is due to David Baron for this one).
Here's the code:
<table cellpadding=0 cellspacing=0>
<tr valign=top>
<td width=200 style="padding: 0">
<div style="font-size: 22px; line-height: 22px; text-align: right">
<img src="green.gif" vspace=0 width="200" height="52" style="float: left">
<span style="background: red">This text</span>
</div>
<td>
<div style="font-size: 22px; padding-top: 66px; line-height: 22px">
<span style="background: yellow">This
</div>
</table>
The reasoning is that the image is floated. This takes it out of the line box. However, it should be aligned with the top of the line box from which it was displaced. That line box also contains the text. Since the table cell is the same width as the image, there is no room in the first line box for the text to flow along side of it, and so the text is moved down to the next line box. Equally in the second box, there is no room for the text, so it is moved down again. It is now 44 pixels down. Again, there is no room next to the image since the image is 52 pixels high, so a third line box is created. This is 66 pixels down. As a result, in the next table cell a top padding of 66 pixels is required to align the yellow text with the red text.
The code here is the same as before with the exception that the element now has a top padding of 52 pixels, which is what browsers are likely to do with the content - place it below the image. This is incorrect because of the case where some text can fit and some cannot - in this case the text should flow like this:
+----+-+ |IMG |x| Line box 1 | |-+ +----+x| Line box 2 +----+-+ |xxxxxx| Line box 3 +------+
rather than like this:
+----+-+ |IMG |x| Line box 1 | |-+ +----+x| Line box 2 |xxxx+-+ +------+ Line box 3
and the case where the text does this immediately is no different.
<div style="margin: 100px 0">
<span style="line-height: 5px; font-size: 205px">gggg</span><span style="font-size: 205px; line-height: 205px">AAAA</span>
</div>
test to avoid the DIV setting the minimum height of the first SPAN to greater than 5 pixels, and to the similar BR test:
<div style="margin: 100px 0">
<span style="line-height: 5px; font-size: 205px">
gggg</span><br>
<span style="font-size: 205px; line-height: 205px">AAAA</span>
</div>
title="doggo " [title=doggo ]
title="dog " [title="dog "]
To go back to the previous page, click here.
Copyright © RichInStyle.com 2000; all rights reserved. See copyright document for terms of use. Please visit Bukit Lawang flood appeal.