HTML - Paragraphs


  • In HTML, the default paragraph defined in source code is ignored and it will be presented in a single block.
  • To add a manual paragraph, we can use the <p> tag with align attribute left, right, justify.

     <p align="center">paragraph goes here</p>

  • The paragraph defined using <p> will always start on a new line and browsers will automatically add a white space before and after a paragraph on the web page.
  • In addition to the <p> tag, we have a few more tags to structure the paragraph like a horizontal rule, line breaks, and preformatted text.

Tags Description
<p> Defines a paragraph
<hr> Defines a thematic change in the content
<br> Insert a single line break
<pre> Defines pre-formatted text
  • <hr> tag defines a break in the HTML page and it is displayed as horizontal rule.
    <p> paragraph1 </p>
    <!-- adding break using hr tag -->
    <p> paragraph2</p>

  • <br> tag insert a line break (a new line). If it is used inside <p> element, it will insert a line break without starting a new paragraph.

     <!-- adding line break using br tag -->
     <p> paragraph1 <br> paragraph2</p>

  • The <br> and <hr> tag is an empty tag, which means that it has no end tag.
  • <pre> element defines pre-formatted text which means whatever the content inside <pre> element will be displayed as it is.
  • It preserves space and line breaks if present in the content.

            Welcome to Geek4Tutorial

            HTML5 Course

            JavaScript Course

            Python Course

No comments:

Post a Comment

You might also like

Deploy your Django web app to Azure Web App using App Service - F1 free plan

In this post, we will look at how we can deploy our Django app using the Microsoft Azure app service - a free plan. You need an Azure accoun...