Skip to main content

HTML Guide

Stray start tag “br”.

A <br> tag is used in HTML to insert a line break and must be properly placed within elements that can contain phrasing content, such as inside <p> or <div>, but not directly inside elements like <table>, <ul>, or outside the <body>.

A stray <br> tag appears when it is placed in an invalid location according to HTML content model rules, or if it is used outside of any container element.

Correct placement of the <br> tag:

  • Place <br> only within phrasing content, such as inside paragraphs or divs.
  • Do not place <br> directly inside table structures (<table>, <tr>, <ul>, etc.) or outside <body>.

Valid example:

<p>
  First line.<br>
  Second line.
</p>

Invalid example (causes stray tag error):

<ul>
  <br>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

Corrected version without the stray <br>:

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

Example of improper use outside <body>:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Stray br Tag Example</title>
</head>
<br>
<body>
  Content here.
</body>
</html>

Corrected document:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>No Stray br Tag</title>
</head>
<body>
  Content here.<br>
  New line in body.
</body>
</html>

Always ensure that <br> tags are only used where line breaks are permitted and are never placed in forbidden contexts or outside the document body.

Learn more:

Related W3C validator issues