Forums
This topic is locked
"Float:left" style is not behaving as expected. Can i get help ?
06 Oct 2009 11:04:33 ps sheba posted:
Hi everyone,The following code:
<head> <title>test</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <style type="text/css"> #first {width:1em; float:left; border:1px solid red;} #second {width:10em; border:1px solid blue;} </style> </head> <body> <h1 id="first"> A</h1> <h1 id="second">B</h1> </body>
Yields a page where "B" is placed next to "A" at its' right side, a bit highr though. When i change "width" style of #second selector into 1em, "B" drops down beneath "A" as opposed to "float:left" of #first selector.
Can anyone explain me why, when "width" of #second selector is 1em , B is not placed at the right side of "A" ?
Thanks
Replies
Replied 18 Oct 2009 21:47:47
18 Oct 2009 21:47:47 Patrick Julicher replied:
Hi,
Try the following code. This works!
Kind regards, Patrick
Try the following code. This works!
<head> <title>test</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> #first {width:1em; float:left; border:1px solid red;} #second {width:5em; border:1px solid blue;} </style> </head> <body> <div id="first"> [h1]A[/h1] </div> <div id="second"> [h1]B[/h1] </div> </body>
Kind regards, Patrick