html – How to write BR tag correctly?

Question:

There was a question about the br tag. How should you write it correctly: <br> , </br> , or <br /> ?

Answer:

Depending on the specification: for DOCTYPE HTML it will be correct <br> , for DOCTYPE XHTML – <br /> . It is common for XHTML to put a slash before the closing parenthesis in single tags: <br />, <hr />, <input /> , etc.

The spelling </br> is incorrect, because BR is a single tag, and the slash after the opening parenthesis is for closing descriptors only.

Scroll to Top