Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What is <br> element in HTML?

Sheza Munir

We use the <br> element in HTML to create a line break in the text. It helps restructure the text by moving the proceeding text to the next line.


The <br> tag is different from most other tags because it is an empty tag, which means it does not need an end tag. It supports general global attributesattributes common to all HTML elements, e.g. class, id, lang, title etc..


This tag does not need to be styled with CSS, as it only creates a line break in a block of text. It has no visual attributes or dimensions which would require styling.

However, the spacing allowed by the <br> tag can be adjusted with the margin property.


Using the <br> tag to create new paragraphs is not good practice. Screen readers cannot announce the content contained between <br> elements as it is an empty tag. As such, it does not enclose a piece of text. This can cause confusion for those using a screen reader to read.

Instead, we should use the <p> tag for paragraphs.

Code example

The following example shows how we can use the <br> tag in HTML:

<!DOCTYPE html>
<html lang="en">
<head> <!--- meta-data about the webpage --->
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> "br Element Code Example</title>

  <p> <!--- new paragraph --->
    Hello! <br> I hope this helped. <!--- moves the text after "Hello" to a new line --->




Sheza Munir
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring