Open In App

Different ways to add Breaks and Spaces in HTML.

In HTML, Breaks and Spaces can be added using various elements and entities. The <br> tag creates a line break, while &nbsp; represents a non-breaking space. Additionally, the <p> tag defines a paragraph, creating space between blocks of text.

CSS properties like margin and padding can also be used for more precise control over spacing within HTML elements, offering flexibility in design and layout.

Line Breaks

First line<br>Second line
<p>Paragraph 1</p>
<p>Paragraph 2</p>

Horizontal Spaces

First&nbsp;Second
<pre>
Preformatted
Text with Spaces
</pre>
<style>
.preserve-space {
white-space: pre;
}
</style>

<div class="preserve-space">Preserve Spaces</div>
Article Tags :