Back to Content

: The Line Break element

files/en-us/web/html/reference/elements/br/index.md

latest4.3 KB
Original Source

The HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.

{{InteractiveExample("HTML Demo: <br>", "tabbed-standard")}}

html
<p>
  O'er all the hilltops

  Is quiet now,

  In all the treetops

  Hearest thou

  Hardly a breath;

  The birds are asleep in the trees:

  Wait, soon like these

  Thou too shalt rest.
</p>
css
p {
  font-size: 1rem;
  font-family: sans-serif;
  margin: 20px;
}

As you can see from the above example, a element is included at each point where we want the text to break. The text after the begins again at the start of the next line of the text block.

[!NOTE] Do not use to create margins between paragraphs; wrap them in {{htmlelement("p")}} elements and use the CSS {{cssxref('margin')}} property to control their size.

Attributes

This element's attributes include the global attributes.

Deprecated attributes

  • clear {{Deprecated_Inline}}
    • : Indicates where to begin the next line after the break.

Styling with CSS

The element has a single, well-defined purpose — to create a line break in a block of text. As such, it has no dimensions or visual output of its own, and there is very little you can do to style it.

You can set a {{cssxref("margin")}} on elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice — you should use the {{cssxref("line-height")}} property that was designed for that purpose.

Accessibility

Creating separate paragraphs of text using is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. Screen readers may announce the presence of the element, but not any content contained within s. This can be a confusing and frustrating experience for the person using the screen reader.

Use <p> elements, and use CSS properties like {{cssxref("margin")}} to control their spacing.

Examples

Basic br

In the following example we use elements to create line breaks between the different lines of a postal address:

html
Mozilla

331 E. Evelyn Avenue

Mountain View, CA

94041

USA

Result

{{ EmbedLiveSample('Basic_br', 640, 120) }}

Technical summary

<table class="properties"> <tbody> <tr> <th scope="row"> <a href="/en-US/docs/Web/HTML/Guides/Content_categories" >Content categories</a > </th> <td> <a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content" >Flow content</a >, <a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content" >phrasing content</a >. </td> </tr> <tr> <th scope="row">Permitted content</th> <td>None; it is a {{Glossary("void element")}}.</td> </tr> <tr> <th scope="row">Tag omission</th> <td> Must have a start tag and must not have an end tag. In XHTML documents, write this element as <code>&#x3C;br /></code>. </td> </tr> <tr> <th scope="row">Permitted parents</th> <td> Any element that accepts <a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content" >phrasing content</a >. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td> <a href="https://w3c.github.io/html-aria/#dfn-no-corresponding-role" >No corresponding role</a > </td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td> <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/none_role"><code>none</code></a>, <a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/presentation_role"><code>presentation</code></a> </td> </tr> <tr> <th scope="row">DOM interface</th> <td>{{domxref("HTMLBRElement")}}</td> </tr> </tbody> </table>

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("address")}} element
  • {{HTMLElement("p")}} element
  • {{HTMLElement("wbr")}} element