w3resource

HTML br tag and element

1. HTML br (line break) element creates a line break in text within an HTML document.

2. Appropriate usage of the br element is to use it within a poem or an address.

3. HTML br element should not be used to create vertical space between two chunk of text or content. You must use stylesheets for that purpose.

4. br element can not contain any content by itself.

5. If you want to make sure that a line break does not occur between two words, use  

Syntax

text content<br>text content 

Category

HTML br element is an inline element.

Whether both start and end tags are required

HTML br element requires start tag only.

Can contain

HTML br element can not contain any element.

Can reside within

HTML br element can reside within inline as well as block level elements.

Attributes

Attributes specific to this element

None.

Identifiers

id, class.

language information and text direction

lang, dir.

Title

Title.

Style

Style.

clear

This attribute specifies the place of appearance of the next line in a visual browser, after a line break is created by br element. Possible values of this attribute are -

  • none : The next line will begin normally. This is the default value.
  • left : The next line will begin at nearest line below any floating objects on the left-hand margin.
  • right : The next line will begin at nearest line below any floating objects on the right-hand margin.
  • all : The next line will begin at nearest line below any floating objects on either margin.

This attribute is deprecated.

Events

The element does not support any event attributes.

Supported doctypes

HTML 4.01 Strict, HTML 4.01 Transitional, and HTML 4.01 Frameset.

Example of using HTML br element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>html br tag example</title>
</head>
<body>
<p>Friends park<br> 
St. Xaviers Road<br>
Kanainatshal<br>
Sripally<br>
</p>
</body>
</html>

Result

html br tag and element

View this example in a separate browser window

HTML br tag example.

Pictorial presentation

html-br-tag

Previous: HTML p tag and element
Next: HTML pre tag and element

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.