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>
البحث
الأقسام
إقرأ المزيد
التعليم
George Washington Carver
بواسطة Modern American History 2024-08-02 16:31:15 0 11كيلو بايت
التعليم
Chinese Exclusion
بواسطة Modern American History 2024-08-02 16:41:02 0 11كيلو بايت
Technology
Ethical Code of Conduct
An ethical code of conduct is a set of principles and guidelines designed to help professionals...
بواسطة ALAGAI AUGUSTEN 2024-07-16 17:00:57 0 9كيلو بايت
Business
How to Start Selling on Amazon FBA: A Step-by-Step Guide
Are you looking to tap into the booming world of e-commerce? Selling on Amazon using Fulfillment...
بواسطة Mpatswe Francis 2024-09-18 20:21:05 0 9كيلو بايت
Physics
PHYSICS PAPER 2
Physics paper 2
بواسطة Question Bank 2024-09-05 12:00:28 0 14كيلو بايت
Talksphare https://talksphare.com