Line breaks (<br>)

0
2K

The <br> tag is used to insert a single line break in your HTML content. It's an empty element, meaning it doesn't have a closing tag.

Basic Usage

HTML
<p>This is a paragraph with a <br> line break.</p>

Example with Multiple Line Breaks

HTML
<p>This is a poem:<br>
  Line 1<br>
  Line 2<br>
  Line 3</p>

Important Points

  • Inline element: Unlike paragraphs, <br> is an inline element, meaning it doesn't start on a new line and doesn't take up the full width available.
  • Limited use: While <br> can be useful in specific cases, it's generally recommended to use paragraphs for better structure and readability.
  • Accessibility: Excessive use of <br> can make content difficult to read for users with visual impairments.

When to Use <br>

  • Poetry or addresses: Where preserving specific line breaks is important.
  • Short, non-paragraph content: For very short lines of text that don't warrant a full paragraph.

Example with Headings, Paragraphs, and Line Breaks

HTML
<!DOCTYPE html>
<html>
<head>
  <title>Headings, Paragraphs, and Line Breaks</title>
</head>
<body>

<h1>This is a Main Heading</h1>

<p>This is a paragraph with a <br> line break.</p>

<h2>Subheading</h2>

<p>This is a poem:<br>
  Line 1<br>
  Line 2</p>

</body>
</html>
Pesquisar
Categorias
Leia Mais
Educação
UNEB REPORT ON UACE CANDIDATES' WORK 2023
UNEB REPORT ON UACE CANDIDATES' WORK 2023
Por Landus Mumbere Expedito 2024-08-10 13:26:00 0 3K
Business
Tips and Tricks of Business Automation
Automation drives innovation, addressing the needs of various industries. Choosing intelligent...
Por ALAGAI AUGUSTEN 2024-07-20 18:37:16 0 3K
Physics
WAKISSHA UACE PHYSICS PAPER 2 2024
WAKISSHA UACE PHYSICS PAPER 2 2024
Por Landus Mumbere Expedito 2024-08-01 18:31:28 1 4K
Educação
Lunch Atop A Skyscraper
Por Modern American History 2024-08-02 16:39:22 0 3K
Chemistry
S.4 CHEMISTRY WAKATA PRE MOCK QUESTIONS 2
https://acrobat.adobe.com/id/urn:aaid:sc:EU:85bd6cfc-45b5-4737-b430-d0e1fce698e9
Por Landus Mumbere Expedito 2024-07-19 23:27:53 0 3K