loading

HTML Paragraphs


A paragraph is often a chunk of text that always begins on a new line.


Html, Html5, Html Tutorials, Learn Html, Free Html Tutorials, Html Example, Html Explained, Html Paragraphs, Horizontal Rule, Line Break, Preformatted Text

HTML Paragraphs

The paragraph is defined by the HTML <p> element.

Every paragraph begins on a new line, and browsers prefix and end paragraphs with white space, or margins, by default.

Example

				
					<p>This is a title.</p>
<p>This is another title.</p>
				
			

HTML Display

It is impossible to predict how HTML will appear.

Resized windows and large or small screens will produce various outcomes.

You cannot alter the presentation of HTML by including extra lines or spaces in your code.

When the page is displayed, the browser will automatically eliminate any additional lines and spaces:

Example

				
					<p>
This title
contains a lot of words
in the source code,
but the browser
ignores it.
</p>

<p>
This title
contains         a lot of gaps
in the source         code,
but the        browser
ignores it.
</p>

				
			

HTML Horizontal Rules

A theme break in an HTML page is defined by the <hr> tag, which is typically shown as a horizontal rule.

In an HTML page, the <hr> element is used to define a change or to split content:

Example

				
					<h1>This is title 1</h1>
<p>This is some content.</p>
<hr>
<h2>This is itle 2</h2>
<p>This is some other content.</p>
<hr>
				
			

The <hr> tag is an empty tag, which means that it has no end tag.

HTML Line Breaks

A line break is defined by the HTML <br> element.

If you want to insert a new line without beginning a new paragraph, use <br>:

Example

				
					<p>This is<br>a sentence<br>with line breaks.</p>
				
			

The <br> tag is an empty tag, which means that it has no end tag.

The Poem Problem

There will be just one line displaying this poem:

Example

				
					<p>
  My Doll lies over the ocean.

  My Doll lies over the sea.

  My Doll lies over the ocean.

  Oh, bring back my Doll to me.
</p>

				
			

Solution - The HTML < pre > Element

Preformatted text is defined by the HTML <pre> element.

When text is displayed inside a <pre> element, line breaks and spaces are preserved and it is displayed in a fixed-width font, often Courier:

Example

				
					<pre>
  My Doll lies over the ocean.

  My Doll lies over the sea.

  My Doll lies over the ocean.

  Oh, bring back my Doll to me.
</pre>

				
			

HTML Tag Reference

CodingAsk’ tag reference contains additional information about HTML elements and their attributes.

Tag Description
<p> Defines a paragraph
<hr> Defines a thematic change in the content
<br> Inserts a single line break
<pre> Defines pre-formatted text

HTML

HTML5

HTML tutorials

Learn HTML

Free HTML tutorials

HTML Example

HTML Explained

Html Paragraphs

paragraphs
horizontal rule
line break
preformatted text

Paragraphs are the basic building blocks of written content on web pages. They help organize your text and make it easier for readers to consume.

To create a new paragraph, simply enclose your text within the opening <p> and closing </p>.

Understanding these basic HTML paragraphs and text formatting elements is crucial for creating well-structured and visually appealing web content. As you progress through your HTML learning journey, you’ll find many opportunities to put these concepts into practice.

Share this Doc

HTML Paragraphs

Or copy link

Explore Topic