HTML Paragraphs

HTML Tutorial

HTML Paragraphs

HTML paragraphs are used to display blocks of text on a web page. They are defined using the <p> tag.


Basic Paragraph Example


 

 Browsers automatically add space (margin) before and after each paragraph.


Paragraph with Line Breaks

The <br> tag is used to break a line inside a paragraph.


 


HTML Paragraph with Formatting

You can format text inside a paragraph using inline tags.


 


HTML Paragraph with Alignment

Text alignment can be done using CSS.


 


 Paragraph with Color


 


HTML Paragraph with Background Color


 


HTML Paragraph with Title Attribute

The title attribute shows text when you hover over it.


 


Preserving Spaces Using <pre>

HTML ignores extra spaces and line breaks. Use <pre> to preserve formatting.


 


Common Mistakes

 Incorrect:

<p>This is a paragraph
<p>This is another paragraph

 Correct:


 


 Important Points

  • <p> is a block-level element

  • Browsers add margin automatically

  • Use <br> for line breaks, not new paragraphs

  • Use CSS for styling paragraphs

You may also like...