Forum Moderators: not2easy
I have an iframe that I am floating to the right and I want it to be displayed on the right so that my paragraphs wrap around it(Like the old deprecated align attribute).
<div>
<iframe style="float:right;" .....>
<p></p>
<p>/p>
etc..
</div>
This works perfectly fine in Moz.
In IE the text will not 'wrap' around the iframe, instead the paragraphs begin below the iframe, as if they were 'cleared'. Anyway, I think this is happening because my paragraphs have a width of 90% and the iframe is bigger than the remaining 10% of the container div. So basically, IE decides to move the paragraphs down to where they can be their full 90%. Make sense?
This is a fluid layout so I cant really change the 90% width of the paragraphs.
Anyone have any suggestions?
Thanks
<p style="width:90%;"><iframe src="" style="width:100px;height:100px;float:right;"></iframe>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
paragraphs have a width of 90%
It could be IE's box model screwing things up because the <p> has a width (There are two related issues, one that afflicts IE5.x and IE6 Quirks, and a different one that afflicts IE standards--from what I can tell, either one could potentially result in the problem you describe).
The folks at PIE suggest that you never give the block element which a float will be overlapping an explicit width. Check out this article on the PIE site for details. It might help. ( [positioniseverything.net...] ).
I think this is happening because my paragraphs have a width of 90%
It is.. because that width is triggering IE's buggy float model.. (it will happen with a div as well as an iframe)
you can usually compensate for the IE float model by hacking in a height , but you would need to wrap your <p>'s in a div or something.. and even then it this scenario it means that IE won't wrap the text ..
instead of having a width on the <p> element could you use a left/right margin for it?
e.g. p {margin: 1em 5%;}
Suzy
too slow.. cEM beat me to it.. :)
instead of having a width on the <p> element could you use a left/right margin for it?
What about removing the 90% from the general p selector and adding it to a classname which you could then apply to non-float-adjacent <p> tags? More work, I suppose, but a solution if nothing else pans out.
#main p{width:90%;}
Meaning every single paragraph across my 200+ page site is 90% of my main container div, so thats not really an option :)
But I did find a workaround that accomplishes what I need, not perfect but good enough.