Line breaks (<br>)

0
9KB

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
Autre
Definition of Statistics
Statistics is a branch of mathematics that deals with collecting, analyzing, interpreting,...
Par Tebtalks Access 2024-07-12 19:44:34 0 23KB
Computer Programming
Keywords, Multiple Output, and Documentation
1. Keywords: Keywords are reserved words in Python that have special meanings and cannot be...
Computer Programming
Italic Text in HTML: <i> and <em>
To make text italic in HTML, you can use either the <i> or <em> element. Both...
Par HTML PROGRAMMING LANGUAGE 2024-08-29 01:53:32 0 9KB
Éducation
The Compromise of 1877
The Compromise of 1877, also known as the Wormley Agreement, the Bargain of 1877, or the Corrupt...
Par Modern American History 2024-07-19 05:48:55 0 10KB
Chemistry
UCE CHEMISTRY SCORING GUIDE
UCE CHEMISTRY SCORING GUIDE
Par Landus Mumbere Expedito 2024-08-10 13:47:53 0 11KB
Talksphare https://talksphare.com