JavaScript Tutorial

HTML Paragraphs

The HTML paragraph tag is used to define a paragraph within a webpage. The browser automatically adds some white space or margin before and after a paragraph.

Here is an example for you.

Output of above code will be as below:

1. <Pre> Tag

If we try to add extra space within paragraph content, the browser will neglect all the spaces except for a single space between words. To overcome this issue, we have the <pre> tag which displays the content with the white space as we typed it between paragraphs. The <pre> tag is used for displaying preformatted text such as code snippets or ASCII art.

Alternatively, we can also use the <br> tag to add a line break within a paragraph. The <br> tag is an empty element and does not require a closing tag.

Code example for <pre> tag.

Output will be:

Supporting Browsers

Element

“Google Chrome

Microsoft

Firefox

Opera

Safari

Marquee

Yes

Yes

Yes

Yes

Yes

Go back to Previous Course