Your second div
is clearing your first, but only the text. If you set a left margin you can tell it to sit next to the floated div.
.div2 {
margin-left: 100px; /* new line */
background: yellow;
}
Note: IE 6 and 7 incorrectly move the second div
past the first one, due to hasLayout
. You can search online for more information about the problems associated with it. There is also a 3px
"text jog" present in IE 6 (possibly 7 too, I can't remember) which usually meant, to display the same in all browsers, one would actually make the margin-left: 103px
to accommodate IE's weirdness.