2

In HTML5 should you use <br> or <br />? also the same question for a <div>.

I have noticed using breaks rendering in IE 10 sometimes causes a miss calculation of height unless the window is re-sized. (hidden areas seem to causes this not figured out the specific HTML yet)

If div's should be closed with </div> then I notice a lot of library's are presuming is allowed (clearing floats is a common one <div class="clear" />)

Dreamwalker
  • 3,032
  • 4
  • 30
  • 60

1 Answers1

0

Divs are not self closing. <br /> is for XHTML. I'd bet you aren't serving your pages as XHTML so don't do that. Using self-closing tags in HTML, as the break you show, forces the browser to treat your markup as an error and has to guess at what you meant. It's called "tag soup". While browsers do a pretty good job at that, you shouldn't do that any more than entering wrong code with a programming language and hoping the software handles the mistake.

Validate your markup and see what the validator says. Read the spec to see how such things are to be written.

Rob
  • 14,746
  • 28
  • 47
  • 65