HTML Tutorial
HTML - Introduction HTML - Basic HTML - Structure HTML - Element HTML - Attributes HTML - Headings HTML - Paragraphs HTML - Styles HTML - Formatting HTML - Phrase Tags HTML - Quotations HTML - Comments HTML - Colors HTML - CSS HTML - Links HTML - Images HTML - Tables HTML - List HTML - Inline elements HTML - Block elements HTML - Classes HTML - Id HTML - Javascript HTML - File Path HTML - Iframe HTML - Responsive HTML - Computer Code HTML - Head tag HTML - Events HTML - Url Encoding HTML - Entities HTML - Validation
HTML Forms
HTML - Forms HTML - Form Elements HTML - Input types HTML - Input Attributes
HTML5
HTML5 - Introduction HTML5 - New Elements HTML5 - Semantics HTML5 - Style Guide
HTML Media
HTML - Video HTML - Audio HTML - Embed Multimedia
HTML Graphics
HTML - Canvas HTML - SVG
HTML APIs
HTML - Geolocation HTML - Drag & drop HTML - Web Storage HTML - Web Workers
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types

HTML Paragraphs

The HTML <p> element represents a paragraph.

Paragraphs are usually represented in visual media as blocks of text that are separated from adjacent blocks by vertical blank space.

Run code

When you place a paragraph tag, browser automatically create some empty space (margin) before and after each paragraph.


HTML Empty Spaces

You cannot change the output by adding extra spaces or extra lines in your HTML code.

The browser will remove any extra spaces and extra lines when the page is displayed.

Run code

HTML Preserved tag

If you want your text to follow the exact format of how it is written in the HTML document use the <pre> element.

Any text between the opening <pre> tag and the closing </pre> tag will preserve the formatting of the source code.

Run code

Styling Paragraphs With CSS

You can use CSS to style paragraphs:

Run code

HTML Line break tag

Whenever you use the <br> element, anything following it starts from the next line.

This tag is an example of an empty element, where you do not need closing tag.

Run code

Note: Do not use <br> to increase the gap between lines of text, use the CSS margin property instead.


Non-breaking Space

&nbsp; allows you to create multiple spaces that are visible on a web page

Run code

With the above examples using &nbsp; would allow you to create multiple spaces in a row, something that cannot be done by only pressing the spacebar. To create multiple spaces add one of the above non-breaking space for each time you want an extra space. For example, if you wanted five extra spaces in front of text you could add five of these tags.

Note: If you need to indent or add extra spacing to a paragraph, sentence, or other portion of your web page, we suggest using CSS instead of multiple non-breaking spaces.