On 8/2/07, Thomas Dalton <thomas.dalton(a)gmail.com> wrote:
It's not CSS support, it's HTML support - div
is part of HTML. I just
loaded a text file containing the following in Firefox:
<html><body>
<div>foo</div><div>bar</div>
</body></html>
It printed foo and bar on separate lines.
Er, yes, the div will break a line, because it's a block element. It
will not, however, add any additional vertical whitespace, which <br>
will. Try the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" dir="ltr">
<head><title></title></head>
<body>
<ul>
<li>FooBar</li>
<li>Foo<div></div>Bar</li>
<li>Foo<br />Bar</li>
<li><p>Foo</p><p>Bar</p></li>
<li><p>Foo</p><div></div><p>Bar</p></li>
<li><p>Foo</p><br /><p>Bar</p></li>
</ul>
</body>
</html>
If the previous and next boxes are inline-level, there will be no
difference, because each type of markup effectively adds a line break
that wasn't present before. (Actually there will probably be subtle
differences, because the div will create new block wrappers around the
inline elements, while <br> will not, but there won't be very obvious
differences.) If either the previous or next box is block-level,
however, as in the case being discussed, <br> will add a new line, but
<div></div> will not affect layout without extra style rules, making
it more suitable for clearing.