HTML - <br> Tag



HTML <br> tag is used to break line in a text. When the division of a line is required. Being an empty tag, it is not dependent on an end tag. The <br> tag behaves just like pressing the enter key in a word workstation, when it is used in the HTML code.

In HTML, a paragraph usually begins on a new line, but what if you want content within a paragraph to begin on a new line. In that scenario’s we are going to use the HTML line break.

Syntax

<br>

Attribute

HTML br tag supports Global and Event attributes of HTML. A specific attribute accepted as well which is listed below.

HTML <br> tag supports the following attributes.

Attribute Values Description
clear No Value This ensure that line breaks "cleared" floated or aligned elements above them.

Example of HTML br Tag

In the bellow examples we will witness the usage of br tag in HTML document, and in how many ways we can use the br tag on our webpages.

Breaking a Paragrapgh Element

In the following example, let's see the usage of the <br> element in the HTML documents.

<!DOCTYPE html>
<html>
<body>
   <p>
      Geckos are a group of usually small, usually nocturnal lizards. 
      <br> They are found on every continent except Antarctica. 
   </p>
</body>
</html>

Using br tag for Input field

Considering the following example, where we are going to use the<br> tag to display each input field in the new line.

<!DOCTYPE html>
<html>
<body>
   <form>
      <input type="text" placeholder="Enter your name" />
      <br>
      <input type="phone" placeholder="Enter your phone" />
      <br>
      <input type="email" placeholder="Enter your email" />
   </form>
</body>
</html>

Applying Clear attribute on Paragraph

Let's look at the another scenario, where we are going to use clear attribute on the <br> tag. There is no floating element so the output will seem normal.

<!DOCTYPE html>
<html>
<body>
   <p>
      Tutorials Point India Private Limited,<br>
      Incor9 Building, Kavuri Hills,<br> Madhapur,
      Hyderabad, <br clear>Telangana - 500081, INDIA
   </p>
</body>
</html>
Note: Do not use br tag to set the margin or padding on paragraph or any texual element.

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
br Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements