Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

HTML 5: Is it <br>, <br/>, or <br />?

I've tried checking other answers, but I'm still confused — especially after seeing W3schools HTML 5 reference.

I thought HTML 4.01 was supposed to "allow" single-tags to just be <img> and <br>. Then XHTML came along with <img /> and <br /> (where someone said that the space is there for older browsers).

Now I'm wondering how I'm supposed to format my code when practicing HTML 5.

Is it <br>, <br/> or <br />?

Answer*

Draft saved
Draft discarded
Cancel
4
  • wait, text/html mimetype is strict XML? Commented Mar 20, 2013 at 7:00
  • 1
    You shouldn't serve it with an XML declaration if using text/html, but the content can be otherwise valid XML (e.g. generated from something that outputs XML, like XSLT output or an object that serializes to XML). Commented Mar 20, 2013 at 10:49
  • Still not understanding: if text/html should have a <br />, when should I use unclosed <br>? Commented Mar 20, 2013 at 16:10
  • 3
    I think it was Netscape Navigator 3 or 4 which didn't like <br/>, certainly nothing to be worried about in this day and age. Commented Jul 4, 2014 at 16:46

lang-html

AltStyle によって変換されたページ (->オリジナル) /