Using the HTML Paragraph Tag
As with any text-centric document, the paragraph is a rather crucial formatting tool. In HTML, the paragraph tag specifies a block of text that should be treated as a singular element, as well as allowing for the appropriate spacing when rendered within the browser. In this tutorial you will learn how to use and where to place the paragraph tag in your HTML document.
This is a sample HTML page that uses paragraph tags:
<html xmlns="http://www.w3.org/1999/xhtml" >
<title>This is the heading</title>
<h1> Heading 1 </h1>
<p>The paragraph will go between these tags.</p>
<p>Another paragraph can go beneath the top paragraph
And there will be an automatic space between the two paragraphs.</p>
For our sample HTML document, you can see that there is a Header element placed above the paragraph tag, which is then followed by a second paragraph. By default, the paragraph tag will create a space below the closing tag, which will separate our two paragraphs when displayed in the browser.
A Few Last Words
When it comes to HTML, semantics are really everything. Making sure your pages are well formed will make revisiting your code easier later on, and will keep your HTML pages standards compliant. The paragraph tag should not just be thought of as a quick method of formatting (although it is), but rather a means in which to further encapsulate and label content on the document level.
Download Source Files