Line breaks (<br>)

0
9χλμ.

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
Workbook and Worksheet Basics
Workbook Think of a workbook as a digital binder. It's a container that holds one or more...
από Microsoft Excel 2024-07-26 04:35:59 0 9χλμ.
Business
Steps to Write a Business Plan
A comprehensive business plan is a crucial tool for launching and growing a successful...
από Mpatswe Francis 2024-08-31 18:37:22 1 14χλμ.
Computer Programming
Inline Styles in HTML
Inline styles are a way to directly apply CSS properties to individual HTML elements. They are...
από HTML PROGRAMMING LANGUAGE 2024-08-29 02:14:38 0 10χλμ.
Computer Programming
HTML Horizontal Rules (<hr>)
The <hr> tag represents a thematic break in a page, typically displayed as a horizontal...
από HTML PROGRAMMING LANGUAGE 2024-08-15 01:26:07 0 9χλμ.
Biology
UACE BIOLOGY EDUCAN MOCK 2024
UACE BIOLOGY EDUCAN MOCK 2024
από Landus Mumbere Expedito 2024-08-11 11:48:05 0 10χλμ.
Talksphare https://talksphare.com