HTML BR Tag is used to insert a line break in continuous text in a web page. The most common use of BR is to take the following text to new line. This is a singular tag that inserts a line feed before and after the text thus rendered.
Features of HTML BR Tag
- BR tag is an empty tag. It is not a paired tag and it does not allow any content.
- Line Break Tag adds white space after the preceding text and adds line feed to the following text.
- You can create any number of line breaks in a web page.
- Multiple <BR> tags add blank lines in a web page.
Attributes of HTML BR Tag
ID
This attribute is used to give identification to a line break defined with <BR> tag. The ID must be an alphanumeric string. The ID value for each element of web page must be unique. This ID is used in a script to manipulate it on the basis of interaction of the user.
CLASS
This attribute is used to associate a line break with a class that specifies the consistent style for multiple elements in a web page.
STYLE
Style attribute is used to add additional styling to a line break. You can set styles in a string form with CSS element and value pairs separated by semicolons.
TITLE
Title attribute is used to set tooltip text for a BR tag. When the user rests the mouse cursor on the line break, a value assigned to TITLE attribute appears in a small outlined box.
CLEAR
Clear attribute most commonly used attribute with a BR tag when text is used along with an image. This attribute extends the <BR>Tag. The values allowed are LEFT, RIGHT, ALL and NONE. CLEAR attribute with value LEFT makes the text appear after left aligned image. CLEAR attribute with RIGHT value makes the text appear after the right aligned image.
BR Tag Example
<TITLE> Welcome to CSVeda.com </TITLE> <HTML> <BODY> Lorem ipsum dolor sit amet, <BR><BR>Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. <img src="F:\CSVeda\HTML\codes\flower.jpg"><BR><BR CLEAR="RIGHT">Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. <BR>Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. <BR><BR>Etiam sit amet orci eget eros faucibus </BODY> </HTML>