Line breaks (<br>)

0
8كيلو بايت

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>
البحث
الأقسام
إقرأ المزيد
Technology
Management Information Systems (MIS)
Management Information Systems (MIS) are integrated systems designed to support management and...
بواسطة Business Information Systems (BIS) Course 2024-08-01 16:58:59 0 10كيلو بايت
Technology
Computer Viruses
A computer virus is a type of malicious software (malware) designed to replicate itself and...
بواسطة ALAGAI AUGUSTEN 2024-07-13 17:32:43 0 11كيلو بايت
التعليم
S.4 SOLUTIONS TO THE PHYSICS SEMINAR QUESTIONS
S.4 SOLUTIONS TO THE PHYSICS SEMINAR QUESTIONS
بواسطة Landus Mumbere Expedito 2024-07-26 17:07:09 0 12كيلو بايت
Technology
The VLOOKUP function in Excel
The VLOOKUP function in Excel is used to search for a value in the first column of a table and...
بواسطة Microsoft Excel Tips 2024-10-16 00:58:30 0 17كيلو بايت
Talksphare https://talksphare.com