Line breaks (<br>)

0
8KB

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>
Pesquisar
Categorias
Leia mais
Computer Programming
Comparing Data Types and Conditional Expressions
Comparing Data Types: In Python, you can compare data types using the type() function. This...
Biology
S 4 BIOLOGY FACILITATION 2024
S.4 BIOLOGY
Por Landus Mumbere Expedito 2024-07-19 04:24:34 0 9KB
Technology
Creating a login form using HTML and CSS
Creating a login form using HTML and CSS is a fundamental skill in web development. Here's a...
Por Tebtalks Access 2025-01-21 01:24:55 0 10KB
Physics
SEPTA-O-LEVEL PHYSICS SEMINAR SLATED FOR 23RD JUNE 2024 AT ST. JOSEPH OF NAZARETH HIGH SCHOOL KAVULE-KATENDE
https://acrobat.adobe.com/id/urn:aaid:sc:EU:39c1aa82-237a-43bf-ba1a-fbe5223d26f1
Por Question Bank 2024-07-14 19:52:41 2 13KB
Technology
Popular Linux Distributions
Linux distributions, or distros, come in various forms tailored to different user needs, ranging...
Por Tebtalks Access 2024-07-13 07:29:49 0 9KB
Tebtalks https://tebtalks.com