Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Paragraph
Paragraph

In HTML <p> element defines paragraph and HTML documents are divided into paragraphs.


  • Paragraph is a pair tag <p></p>
  • Paragraph does not include new line
  • Paragraph does not add extra spaces
  • Any number of spaces and lines count as one

Browser automatically will add some space before and after paragraph.

Syntax

<p> Content </p>


Example

This is paragraph



Note:

If you give extra space and new lines in paragraph it will appear as single space and single line break. This problem can be resolved by using preserve tag <pre></pre>


Preserve tag <pre></pre> is explained in next chapter.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Write a code to define a paragraph.
  • The content (data) of paragraph should be I am paragraph
  • Define an other paragraph in same code.
  • The content (data) of second paragraph should be I am paragraph 2
  • Now give extra space or new line in paragraph 2.
  • Finally compare the results of both paragraphs.

save file with name task.html or task.htm and then open it using any browser and see results.


Note:

Do not use <br /> element for new line or break line, give new line by putting cursor between I am and paragraph and then press enter button and so on.


Solution

I am paragraph

I am paragraph 2