The <br> tag inserts a semantic line break inside the same text block. The real pitfall is using it as a layout spacer instead of CSS, which hurts readability, accessibility, and maintainability.
What does the <br> tag do?
Definition and Purpose
The tag inserts a line break inside the current text block. In production, the important when not rule is this: is for semantic line breaks like addresses, lyrics, or short contact info, not for page layout spacing. Using it as a spacing hack creates readability, accessibility, and maintenance problems.
Syntax
The tag can be written as:
``html
Line one.
Line two after the break.
It can also be written with a self-closing slash (<br />) in XHTML-style HTML, but both are interpreted the same in modern browsers.
Use Cases
The tag is often used in scenarios where text needs manual line breaks — such as poetry, song lyrics, addresses, or formatted contact information. It should be avoided for layout spacing, as CSS provides more flexible and accessible methods for controlling vertical spacing.
Feature | Description |
|---|---|
Tag Type | Empty tag (no closing tag required) |
Display Behavior | Breaks text to the next line within the same block element |
Common Uses | Poems, addresses, short quotes, or text requiring specific line breaks |
Best Practice | Avoid using |
Example
``html<p>
Roses are red,
Violets are blue,
HTML is great,<br>
And so are you.</p>
Here, each tag forces the next line of the poem to start directly beneath the previous one without extra paragraph spacing.
Practical scenario
Render a multi-line address in a footer without adding extra block elements.
Common pitfalls
- Using
for layout spacing instead of CSS. - Stacking many breaks which hurts readability.
- Forgetting that screen readers announce line breaks differently.
Use
for semantic line breaks only. Test with a screen reader and responsive layouts.Think of as pressing the Enter key once when typing text — it moves to the next line but stays within the same paragraph or container. In contrast, using is like starting a new paragraph entirely with spacing before and after it.<p>
The tag is used to insert a single line break in text. It is a simple and inline element that helps control text flow where natural line breaks are required. For structure or spacing, always prefer semantic HTML and CSS rather than relying on multiple tags.
Use the relevant interview-question hub first, then move into a concrete study plan before targeted company sets.