How to Code Paragraphs for HTML Web Pages

When you’re building pages in HTML5, you will use familiar paragraph container tags. The container tags for paragraphs are <p> and </p>, and you use them to separate text into paragraphs. Each paragraph must have its own set of paragraph tags.

As you look at the HTML of different websites, you might notice that sometimes <p> tags aren’t used. Instead, you’ll see <br> (break) tags instead — sometimes several of them — to create the visual effect of having paragraphs.

This is an incorrect use of the break tag and should be avoided. A break tag should be used only when you need a hard break, like in a very long bullet. The reason why using multiple <br> tags is incorrect is that when you apply style sheets, you can get inconsistencies in your design because the style sheet will apply attributes to things like paragraphs.

The <br> tags will not get the same attributes unless you clutter your CSS with code to make them the same. Also, coding your site properly will make your content more compatible with other technologies, such as screen readers and handheld devices.

blog comments powered by Disqus
Advertisement

Inside Dummies.com