Back to HTML

Paragraphs and Line Breaks in HTML

Coding Tutorials Team 22 July 2026

Two elements handle the basic shape of running text, and both are frequently used for the wrong job. The paragraph gets pressed into service as a spacing device, and the line break gets used to create gaps that belong in a stylesheet. Both habits produce markup that is fragile and unhelpful to anyone using assistive technology.

The paragraph element

A paragraph is a block of related sentences. That is the whole definition, and it is the correct wrapper for essentially all running prose on a page.

<p>A paragraph of text. The browser collapses the whitespace in your source, so line breaks here do not appear in the output.</p>

The default margin above and below comes from the browser stylesheet, not from anything in your markup, which is why the gap changes the moment you write your own CSS. It also means margins between adjacent paragraphs collapse into a single space rather than adding together, which surprises people who expect two margins of twenty pixels to produce forty.

The closing tag is technically optional and you should write it

HTML permits omitting the closing paragraph tag, because the parser closes one automatically when the next block element starts. Relying on this is a bad idea. It makes the structure harder to read, it makes an accidental nesting error harder to spot, and it interacts badly with editors that indent based on tag pairs. Write both tags.

What a paragraph may contain

Only text and inline elements. Links, emphasis, code spans and images are all fine. Divs, headings, lists and other paragraphs are not, and inserting one closes your paragraph early and leaves an orphaned closing tag behind. This is the single most common invalid nesting mistake, and because the page still renders it can survive for a long time before anyone notices the structure is not what the source implies.

The line break element

A break forces a new line without starting a new block. It is a void element with no closing tag.

<p> Coding Tutorials Ltd<br> 14 Example Street<br> Newcastle upon Tyne </p>

This is the correct use. The address is one block of content in which the line divisions carry meaning, so a break is describing the content rather than styling it. The other legitimate case is poetry or song lyrics, where line endings are part of the work.

Where the break element is wrong

Two consecutive breaks used to create a gap between blocks of text is a presentational hack. Those two blocks are two paragraphs, and the gap between them is a margin. Marking them up properly means a screen reader announces two paragraphs and a user can navigate between them, whereas the break version presents one long undifferentiated block.

The same applies to using breaks to control where a heading wraps. That works at exactly one screen width and breaks at every other, which on a responsive site means it is wrong almost everywhere. If you genuinely need to control wrapping, a non breaking space between the words that must stay together degrades far more gracefully.

Empty paragraphs are worse

An empty paragraph inserted for vertical space is invisible in a browser and not invisible to a screen reader, which may announce it as a blank paragraph. Several of them in a row produce a run of announcements conveying nothing. Spacing is a presentational concern and CSS margin handles it with a single declaration that can also be adjusted responsively, which markup based spacing cannot.

Preserving whitespace deliberately

When the exact spacing of text matters, as it does for code samples or ASCII layouts, the preformatted element switches off whitespace collapsing entirely and preserves every space and newline as written.

<pre> function greet(name) { return name; } </pre>

It renders in a monospaced font by default. For code specifically, wrapping the contents in a code element as well gives the correct semantics alongside the preserved formatting.

Word break and wrap opportunities

A related element marks a place where a break is permitted but not required, which is useful for long unbroken strings such as file paths or product codes that would otherwise overflow their container. It gives the browser somewhere sensible to wrap without forcing a break at that point on wider screens.

The test to apply

Before reaching for a break, ask whether the line ending is part of what the content means or part of how it looks. An address, a verse and a postal format all fail to make sense without their line divisions, so a break is describing them accurately. A gap before a new section, a wrapped heading or space above an image are all appearance, and every one of them has a CSS property that does the job better and stays correct at every screen size.