HTML paragraph is represented by <p> tag. Paragraph has both opening and closing tags and content is written within the opening and closing tag. like: <p> ... </p>
Here is an Example:
I am paragraph
The element <p> is used to define paragraphs in HTML.
- <p> tag automatically adds space before and after any paragraph.
- If there are multiple spaces added in content within the <p> tag then browsers ignore multiple spaces and treat them as only single spaces.
- If there are multiple lines given in any paragraph then also browsers ignore multiple lines and treat them as single lines. See the example below.
This paragraph has multiple spaces.
This paragraph has multiple lines but browser omits them.
HTML Line Breaks
Line break in HTML is defined by <br> tag.
In case you want to change the line in the paragraph then you can add the <br> tag and line will be changed.
Note:In HTML Writing <br> is sufficient but in XHTML you have to close the tag by writing <br /> .
Here is an example:
This paragraph has Break
HTML pre Tag
As mentioned above <p> tag omits multiple spaces and multiple lines.And there are many cases when you have to put multiple lines as well as spaces.In such case you can use <pre> tag. <pre> tag preserve both multiple lines and space.
Pre tag store both multiple space and multiple line.