HTML Paragraph <p>

The paragraph tag is probably the simplest tag in HTML.

We can use it in pairs only – the opening <p> and closing tag </p> before and after the text respectively.

This is to define the text as a paragraph by surrounding blocks of text within the paragraph tag i.e. <p>.

This way the web browser will automatically add a spacing line before and after the paragraphs to ensure a neat look to your web page.

As you see in the Output section below, the lines of text have neatly been split up and spaced.

One thing to take note of, the last paragraph, although on multiple lines in our code, it is reassembled into a neat and tidy paragraph for output on screen!

Usage

The paragraph tag is a block element used to define paragraphs.

As such, The browser will therefore add some margin before and after the paragraph.

Code:


<!DOCTYPE html>
<html>
<head>
<!-- This is the stylesheet John created in 2020 -->
<link rel="stylesheet" href="/file/stylesheet.css">
</head>

<body>

<p>Welcome to my webpage and paragraph 1.</p>

<p>I have so much to say I'm going to need a lot of paragraphs!</p>

<p>This is a very long paragraph that we will keep writing
on multiple lines in our code and breaking up to see how
it is reassembled when read inside the p tags.</p>

</body>

</html>

Output:

Welcome to my webpage and paragraph 1.

I have so much to say I’m going to need a lot of paragraphs!

This is a very long paragraph that we will keep writing on multiple lines in our code and breaking up to see how it is reassembled when read inside the p tags.