HTML5
Where to use <br>, <br/> and <br /> ?
The <br> element inserts a single line break. A frequent question is whether you should write <br>, <br/>, or <br />. The answer: all three are valid in HTML5 and render exactly the same line break. The difference is purely a matter of syntax style.
All Three Are Valid
<br> is a void (empty) element — it has no closing tag and no content. In HTML5 you can write it in three equivalent ways, all of which the browser renders identically:
Line one<br>Line two
Line one<br/>Line two
Line one<br />Line twoWhich Style Should You Use?
| Syntax | Style | When to use |
|---|---|---|
| <br> | HTML5 style | Preferred in plain HTML5 documents. |
| <br/> | XHTML self-closing | Required in XHTML/XML; also common in JSX-like syntaxes. |
| <br /> | XHTML self-closing (with space) | Older XHTML convention; the space is optional. |
Use <br> for Line Breaks, Not Spacing
The <br> tag is meant only for line breaks that are part of the content — for example, lines of a poem or a postal address. Do NOT use multiple <br> tags to create vertical space between blocks; use CSS margins or padding instead.
<p>
221B Baker Street<br>
London<br>
England
</p>Avoid stacking <br><br><br> to push content down the page. That is a presentation concern — use CSS (margin, padding) instead.
