HTML paragraphs are used to represent blocks of text that are separate from each other. They are typically used to separate different topics, ideas, or sections of content on a web page.
HTML Paragraphs
In HTML, paragraphs are represented using the <p> tag, which is an opening tag that surrounds the text content and a closing tag </p> that marks the end of the paragraph.
You can use our free live html editor to test tutorial codes .
Basic Paragraph :
<p>This is a basic paragraph.</p>
In this example, we have a simple paragraph that contains some text. The opening tag <p> indicates the beginning of the paragraph, while the closing tag </p> marks the end of the paragraph. The text "This is a basic paragraph." is the content of the paragraph.
Paragraph with Multiple Sentences :
<p>This is a paragraph with multiple sentences. It contains more than one sentence.</p>
This example demonstrates how a paragraph can contain multiple sentences. The two sentences are separated by a period followed by a space. The opening and closing tags are the same as in the previous example.
Paragraph with Line Breaks :
<p>This paragraph<br>has a line break<br>in it.</p>
This example shows how a paragraph can contain line breaks. Instead of using multiple paragraphs, you can use the <br> tag to insert line breaks within a single paragraph. The opening and closing tags are still the same, but the <br> tags indicate where the line breaks should be inserted.
Paragraph with Text Formatting :
<p>This is a <strong>strong</strong> paragraph with <em>emphasized</em> text.</p>
This example shows how you can use text formatting tags within a paragraph. The <strong> tag makes the text bold, while the <em> tag italicizes the text. The opening and closing tags for each formatting tag must be included within the opening and closing tags of the paragraph.
HTML paragraphs are a fundamental building block of any web page, and they provide a simple and effective way to organize and structure text content.