Forum Moderators: not2easy
<html>
<body>
<div style="float:left">1</div>
<div style="float:left;clear:left">2</div>
<div style="float:left">3</div>
</body>
</html>
To save you time in figuring this out, here's what the web page looks like in each browser:
IE7:
13
2
FF2:
1
23
Remember I don't want the 3 to clear the 1; I want the 3 to appear to the right of the 1. And, I can't change the order in which the divs appear; I can change only the styles/classes. This also needs to work with arbitrary div content. (As you may have surmised, the "1", "2", and "3" are contrived.)
Thanks.
The outer top of a floating box may not be higher than the outer top of any block or floated box generated by an element earlier in the source document.
What this means is that I have no choice but to re-order the divs.
How have people corrected this for IE?
[edited by: Xapti at 1:34 am (utc) on Nov. 17, 2007]
The text needs to flow around the 3 graphics, as shown in the diagram below. I have 3 variable-sized images and some variable text. Images 1 and 2 always have the same width as each other; image 3 can sometimes be taller than image 1 but is never taller than the sum of the heights of images 1 and 2; and there's always room for the text to flow around the 3 images; but otherwise, the width and height are unknown until the images are pulled from the database.
.___ . ___
¦ . ¦ ¦ . ¦ This text flows
¦ 1 ¦ ¦ . ¦ around the 3
¦___¦ ¦ 3 ¦ pictures. The
.___. ¦ . ¦ periods merely
¦ . ¦ ¦___¦ compensate for
¦ 2 ¦ webmasterworld
¦___¦ deleting extra spaces
and aren't meant to be part
of the diagram.
Looks easy, right? The layouts I tried either place picture 3 so its top is aligned with picture 2's top or place picture 2 so its top is aligned with picture 3's bottom.
I don't expect anyone to solve this for me, but it would be nice!
Thanks, everyone.
Related problem: My div1 and div2 are used on other pages as well, not necessarily together, so they need to be able to float separately at times. Do I need to remove "float:right;" from my definitions of div1 and div2 and adjust every instance of div1 and div2 to somehow be contained by another element that has "float:right;"? I'll do it if that's the only way, but it would not be elegant.