Use the p element to create paragraphs
When creating paragraphs of text in HTML, some WYSIWYG editors and people use double
br (line break) elements to separate the paragraphs visually:
This text is the first paragraph.
This text is the second paragraph.
While this method often provides the desired visual result there is a better way – the
p (paragraph) element:
<p>This text is the first paragraph.</p>
<p>This text is the second paragraph.</p>
The benefits of using the
p element are:
- It makes it easier to control paragraph margins consistently with CSS
- It enables users of screen readers and other assistive technology to “skim” documents by skipping to the next paragraph
- It semantically describes the text as what it is – a paragraph
There are occasions when a single
br element is appropriate, but if you find yourself using multiple consecutive
br elements to separate chunks of text it is very likely that you should be using
p elements instead.
This post is a Quick Tip. Background info is available in Quick Tips for web developers and web designers.
This article has been translated into the following languages:
- Danish: Brug p-elementet til at inddele tekstafsnit
- Turkish: Paragraf oluşturmak için p elementini kullanın
- Previous post: FileVault can cause default applications to reset in Mac OS X 10.5
- Next post: The evolution and future of HTML