HTML BasicsLesson 17 of 36

HTML Line Breaks

The br tag is the line break tag. It pushes whatever comes after it down to a new line, with no gap in between. Because it only breaks a line, it has no content and no closing tag. Of all the tags in HTML, this one is the smallest and the easiest to misuse.

The br tag is the line break tag. It pushes whatever comes after it down to a new line, with no gap in between. Because it only breaks a line, it has no content and no closing tag. Of all the tags in HTML, this one is the smallest and the easiest to misuse.

Line breaks belong inside text that must split at a specific spot. Addresses, poems, and song lyrics are the classic cases, where each line has to start on its own row. The br tag is also handy in headings when a title should wrap at a chosen word instead of wherever the browser decides.

The common mistake is using br to create space. Two br tags in a row make a blank line, but that is a fragile hack, not a layout tool. When you want a gap, start a new paragraph or add a CSS margin. Paragraphs and margins respond to screen size; hard-coded breaks do not.

Where br belongs

Use br for a single break inside a block of text, right at the point where the line should end. An address is the classic example, where each line has to start on its own row. Do not use br to space out images or buttons; margins and padding do that job far better.

HTML
<p>123 Main Street<br>Portland, OR 97201</p>

The enter key myth

Pressing enter in your source code does not start a new line on the page. The browser collapses raw line breaks into single spaces. To control where lines actually split, you need br tags or CSS, never the enter key.

HTML
<p>These words
are on one line in the browser.</p>

Syntax

HTML
<p>Line one<br>Line two</p>

<br><br> for Spacing Breaks Screen Readers and Copy-Paste

Tutorials abuse <br><br> to create paragraph spacing - screen readers pause awkwardly on each br and assistive tech can't skip 'paragraphs'. <br> is ONLY for line breaks inside an address/poem (where line break is content). For spacing use <p> or CSS margin. For long URLs use <wbr> (Word Break Opportunity) not <br>, which would force a break even on wide screens.

HTML
<p>Paragraph one.</p><p>Paragraph two.</p> // not text<br><br>text
https://example<wbr>.com/docs<wbr>/very-long-path

Good to know

  • br is a void tag with no closing partner.
  • It breaks a line with no extra space.
  • Two br tags in a row is a sign you should use a paragraph instead.
  • The enter key in your code does not create a new line on the page.
Try it Yourself Edit the code, press Run, then check what changed in the Result.
Ready
Code
Result

Practice makes it stick

Open the Playground and build your own page with the tags you just learned.

→ Open Playground