Paragraph In HTML

In HTML, paragraphs are defined using the <p> tag. Here’s a quick overview:

A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.


  • Basic Structure: A paragraph starts with an opening <p> tag and ends with a closing </p> tag.

    <p>This is a paragraph.</p>
    
  • Automatic Spacing: Browsers automatically add some white space (a margin) before and after a paragraph.

  • Line Breaks: If you want to add a line break within a paragraph without starting a new one, you can use the <br> tag.

    <p>This is a paragraph with a line break.<br>This is the next line.</p>
    
  • Preformatted Text: For text that requires specific formatting, such as poems or code, you can use the <pre> tag. This preserves both spaces and line breaks.

    <pre>
    This is preformatted text.
    It preserves spaces and line breaks.
    </pre>
    



Post a Comment

0 Comments