HTML5:枚举而不是 ul 用于段落内的内联列表



考虑以下段落:

So in the first set, we start to mix those 3 codes:
- AA
- BB
- CC
with those codes:
- Aa
- Ab
- Ac

to get the perfect result we're looking for.

这一段在语义上不正确吗?如果没有,html5 的编写方式是什么?

  1. 如果我使用 ul,那么它会将段落分成三个部分,这在语义上是不准确的(不是吗?
  2. 可以使用 br 或 span,但随后我必须自己完成所有格式化。

这是我们唯一的两种方式吗?如果是这样,为什么没有枚举元素,如下所示:

<p>
So in the first set, we start to mix those 3 codes:
<enum>
<ei>AA</ei>
<ei>BB</ei>
<ei>CC</ei>
</enum>
with those codes:
<enum>
<ei>Aa</ei>
<ei>Ab</ei>
<ei>Ac</ei>
</enum>
to get the perfect result we're looking for.
</p>

这有什么意义吗?

我想向W3C提出这个建议,你认为这是一个好主意吗?

如果没有,为什么?

我认为使用描述列表是上述特定示例的最佳方法,例如;

<dl>
  <dt>So in the first set, we start to mix those 3 codes:</dt>
  <dd>AA</dd>
  <dd>BB</dd>
  <dd>CC</dd>
  <dt>with those codes:</dt>
  <dd>Aa</dd>
  <dd>Ab</dd>
  <dd>Ac</dd>
</dl>

我终于找到了一个令我满意的答案:https://github.com/whatwg/html/issues/4685。基本上,打破"p"元素没什么大不了的,因为p元素是一个html段落,与英文段落不同。

因此,在

段落内执行列表的 html 方法只是在列表之前断开 p,然后在列表之后创建另一个,如下所示(例如):

<p>The list should be</p>
<ul>
  <li>responsive</li>
  <li>short</li>
  <li>precise</li>
  <li>easy to use</li>
</ul>
<p>to do all the things I want</p>

最新更新