On 22 Sep 2009, Ciaran <> wrote:
> I've come across this small annoying problem many times but never
> managed to figure out a satisfactory solution.
> It's incredibly simple: an element that is floated right which has
> inline content in before it looks different in every browser.
>
> In the past, all browsers rendered the floated element down a line
> which meant a negative margin-top would fix the problem but the
> latest version of firefox and chrome (correctly) display the floated
> content on the same line as the rest of the inline stuff.
>
> I've found one workaround: putting the floated element before the
> inline content correctly renders it in the right spot but I'd prefer
> to keep the HTML clean and fix this with CSS. Any Ideas?
>
> Look at this in FF and then IE and you'll see what I mean:
>
> DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html>
> <head></head>
> <body>
> Some inline content<div style="float:right">floated right!</div>
> </body>
> </html>
Well, for one thing that's invalid markup so it might not be so
surprising that it renders differently in different browsers. Inline
content cannot be contained in the <body> "naked"; it must be nested in
a block element.
--
Neredbojias
http://www.neredbojias.org/
http://www.neredbojias.net/