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
Media and Software Piracy
Media and software piracy refer to the unauthorized copying, distribution, and use of digital...
От ALAGAI AUGUSTEN 2024-07-13 07:52:56 0 11Кб
Chemistry
UACE WAKISSHA CHEMISTRY PAPER 1 GUIDE 2014
UACE WAKISSHA CHEMISTRY PAPER 1 GUIDE 2024
От Advanced Level chemistry 2024-08-31 09:56:47 2 14Кб
Technology
How Technology is Reshaping Our World
From Smart Homes to Smart Cities: Technology is Reshaping Our World. What Tech Innovation Excites...
От ALAGAI AUGUSTEN 2024-07-23 17:35:18 0 13Кб
Computer Programming
HTML: The Building Blocks of the Web
Definition HTML stands for HyperText Markup Language. It's the standard language used to create...
От HTML PROGRAMMING LANGUAGE 2024-08-13 03:09:45 0 9Кб
Computer Programming
String and List
String A string is a data type, and string variables can hold sequences of text....
Talksphare https://talksphare.com