Formatting Paragraphs Separately using CSS3

174 Views Asked by At

Using CSS3, I can format a single paragraph <p> validly. But when I need multiple paragraphs with different formatting, I rename my paragraphs to <p1> and <p2>. I can format them individually, but it does not pass the validity test. How can I do this in a manner where it will still be valid?

The way I am currently doing it gives me the following errors:

Element p1 not allowed as child of element body in this context.
Element p2 not allowed as child of element body in this context.
1

There are 1 best solutions below

0
On

Don't change the element's tag name.

Add a class or an id to the element in order to differentiate between them.

<p class="p1">Paragraph 1</p>

<p class="p2">Paragraph 2</p>

jsFiddle example