HTML <br>
Tag
Concept
The HTML <br>
tag is used to insert a line break within text content, such as in a paragraph or heading. It’s a self-closing tag, meaning it doesn’t require a closing tag. The <br>
tag is particularly useful when you want to create a new line without starting a new paragraph, like in a poem or an address.
Implementation
Example 1: Inserting Single Line Breaks in Text
<p>This is the first line.<br>This is the second line.</p>
Try it out below:
powered by Advanced iFrame. Get the Pro version on CodeCanyon.
This code will create a break between the two sentences, displaying them on separate lines.
Example 2: Using <br>
in a Poem
<p><em>-William Shakespeare</em></p>
<p>To be, or not to be,<br>that is the question:</p>
Here, the <br>
tag is used to separate the lines of a poem, maintaining the poetic structure.
Browser Support
The <br>
tag is supported by all major browsers:
Browser | Support |
---|---|
Chrome | Yes |
Firefox | Yes |
Safari | Yes |
Edge | Yes |
IE | Yes |
Global Attributes
The <br>
tag also supports the Global Attributes in HTML.
Event Attributes
The <br>
tag also supports the Event Attributes in HTML.
Default CSS Settings
The <br>
tag has no default CSS.
Conclusion
The <br>
tag is a simple yet essential tool in HTML, allowing for precise control over the layout of text.
By understanding its usage and how it renders in various browsers, developers can create more readable and aesthetically pleasing content.