Line breaks (<br>)

0
2KB

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>
Rechercher
Catégories
Lire la suite
Health
ED Treatment with Cenforce 200: How Long It Works
Erectile dysfunction (ED) is a condition that affects millions of men worldwide, causing...
Par Lucas Miller 2024-09-11 05:40:20 0 3KB
Physics
weve-been-misreading-a-major-law-of-physics-for-300-years
https://www.sciencealert.com/weve-been-misreading-a-major-law-of-physics-for-300-years
Par Landus Mumbere Expedito 2024-11-03 04:28:05 0 4KB
Éducation
VLOOKUP FUNCTIONS
VLOOKUP is a powerful function in Excel that allows you to search for a value in a table and...
Par Microsoft Excel 2024-09-23 20:04:52 0 3KB
Éducation
MODERN AFRICAN NATIONAL HISTORY MADE EASY
https://acrobat.adobe.com/id/urn:aaid:sc:EU:4838a935-5393-417a-a9b9-a4c21d6109cb
Par Landus Mumbere Expedito 2024-07-18 10:47:57 0 3KB