Html 使用CSS3单独设置段落格式

Html 使用CSS3单独设置段落格式,html,css,validation,formatting,paragraphs,Html,Css,Validation,Formatting,Paragraphs,使用CSS3,我可以有效地格式化单个段落。但是当我需要多个格式不同的段落时,我会将我的段落重命名为和。我可以单独格式化它们,但它没有通过有效性测试。我怎样才能在它仍然有效的情况下做到这一点 我目前的做法给了我以下错误: Element p1 not allowed as child of element body in this context. Element p2 not allowed as child of element body in this context. 不要更改元素的标记

使用CSS3,我可以有效地格式化单个段落。但是当我需要多个格式不同的段落时,我会将我的段落重命名为
。我可以单独格式化它们,但它没有通过有效性测试。我怎样才能在它仍然有效的情况下做到这一点

我目前的做法给了我以下错误:

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

不要更改元素的标记名

向元素添加
id
,以区分它们

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

<p class="p2">Paragraph 2</p>
第1段

第2段