为什么我不能使用  p>?

时间:2021-04-28 18:37:13

I can't find a convincing answer for this. Is it wrong in terms of semantic HTML? SEO unfriendly? Accessibility?

我无法找到令人信服的答案。在语义HTML方面是错误的吗? SEO不友好?辅助功能?

A lot of WYSIWYG editors use it. I think it is a good way to add some extra space between paragraphs, like you do when you're writing a document and want to express 'extra differentiation' between 2 specific paragraphs. Of course you can do that with CSS, but you need to add extra classes like so:

很多WYSIWYG编辑都使用它。我认为这是在段落之间添加一些额外空间的好方法,就像你在编写文档时想要表达两个特定段落之间的“额外区分”一样。当然你可以用CSS做到这一点,但你需要添加额外的类,如下所示:

<p class="extra-space">
  Some text
</p>
<p>
  Other topic
</p>

I'm sure this is not a problem for screen readers. And semantics … why an 'empty paragraph' has not a valid meaning by itself?

我确信这不是屏幕阅读器的问题。和语义......为什么“空段”本身没有有效意义?

2 个解决方案

#1


8  

It's because an empty paragraph is not a paragraph at all. A paragraph is defined as "A paragraph is a self-contained unit of a discourse in writing dealing with a particular point or idea." (by Wikipedia)

这是因为空段落根本不是段落。段落被定义为“段落是一个独立的话语单元,用于处理特定的观点或想法。” (*)

From a typographic point-of-view there are other elements that help seperating content in a more semantic way. If the next paragraph is so important you maybe want to add a heading in front of it.

从印刷的角度来看,还有其他元素可以帮助以更加语义的方式分离内容。如果下一段很重要,你可能想在它前面添加一个标题。

You also violate the rules of seperating content and design. It's just not a good idea. Think of a blog you're writing. If you do something like that, you're typographic appearance may become totally inconsistent because sometimes you use 2 empty paragraphs, sometimes none. It's just not a good idea to mix content and appearance.

您还违反了分离内容和设计的规则。这不是一个好主意。想想你正在写的博客。如果你这样做,你的排版外观可能会变得完全不一致,因为有时你会使用2个空段落,有时候没有。混合内容和外观并不是一个好主意。

#2


1  

It is wrong in terms of semantics because these semantics define a way to properly "Talk" to the machine. Although it displays fine, it is can become an issue when you need some automated process.

它在语义方面是错误的,因为这些语义定义了一种正确地与机器“对话”的方法。虽然它显示得很好,但是当您需要一些自动化过程时,它可能会成为一个问题。

To put it in another perspective, lets say you have a recipe, that works well when you tell it to someone. At some point you are writing down the recipe for an automated robot.

换句话说,让我们说你有一个配方,当你告诉某人时,它很有效。在某些时候,你正在写下自动机器人的配方。

Instead of writing "Add ice cream in the blender" you are writing "Add I scream in the blender"

而不是写“在搅拌机中添加冰淇淋”,​​而不是写“在混合器中添加我的尖叫声”

When you hear it, it is the same. When someone reads it, and can correct the mistake, is fine. What about when the robot reads it ?

当你听到它时,它是一样的。当有人读它,并且可以纠正错误时,没问题。当机器人读取它时呢?

#1


8  

It's because an empty paragraph is not a paragraph at all. A paragraph is defined as "A paragraph is a self-contained unit of a discourse in writing dealing with a particular point or idea." (by Wikipedia)

这是因为空段落根本不是段落。段落被定义为“段落是一个独立的话语单元,用于处理特定的观点或想法。” (*)

From a typographic point-of-view there are other elements that help seperating content in a more semantic way. If the next paragraph is so important you maybe want to add a heading in front of it.

从印刷的角度来看,还有其他元素可以帮助以更加语义的方式分离内容。如果下一段很重要,你可能想在它前面添加一个标题。

You also violate the rules of seperating content and design. It's just not a good idea. Think of a blog you're writing. If you do something like that, you're typographic appearance may become totally inconsistent because sometimes you use 2 empty paragraphs, sometimes none. It's just not a good idea to mix content and appearance.

您还违反了分离内容和设计的规则。这不是一个好主意。想想你正在写的博客。如果你这样做,你的排版外观可能会变得完全不一致,因为有时你会使用2个空段落,有时候没有。混合内容和外观并不是一个好主意。

#2


1  

It is wrong in terms of semantics because these semantics define a way to properly "Talk" to the machine. Although it displays fine, it is can become an issue when you need some automated process.

它在语义方面是错误的,因为这些语义定义了一种正确地与机器“对话”的方法。虽然它显示得很好,但是当您需要一些自动化过程时,它可能会成为一个问题。

To put it in another perspective, lets say you have a recipe, that works well when you tell it to someone. At some point you are writing down the recipe for an automated robot.

换句话说,让我们说你有一个配方,当你告诉某人时,它很有效。在某些时候,你正在写下自动机器人的配方。

Instead of writing "Add ice cream in the blender" you are writing "Add I scream in the blender"

而不是写“在搅拌机中添加冰淇淋”,​​而不是写“在混合器中添加我的尖叫声”

When you hear it, it is the same. When someone reads it, and can correct the mistake, is fine. What about when the robot reads it ?

当你听到它时,它是一样的。当有人读它,并且可以纠正错误时,没问题。当机器人读取它时呢?