HTML p tag defines a paragraph in a webpage. It is a Paired Tag, i.e., it comes with an opening
<p> and a closing
<p> tag is very important, as all the content written on a website needs to get formatted in the form of paragraphs. Browsers automatically add blank lines above and below a paragraph. It separates a paragaph from other content or other paragraphs on the page.
HTML Paragraphs are block level elements, i.e., a new paragraph will always start from a new line. Also, p tags gets automatically closed if another block-element gets inserted before the
Look at the example below, to know how to use
HTML pre tag
<br>, etc. for managing spaces isn’t very convenient. Alternatively, you can use the
<pre> tag to display spaces, tabs, line breaks, etc. exactly as written in the HTML file. It is very helpful in presenting text where spaces and line breaks are important like poem or code.
The following example will display the text in the browser as it is in the source code:
Note: If you want to add some extra space outside the paragraph, then don’t use
<br> tag. Instead, use CSS Margins to change the space above/below the paragraph.