首页 > 解决方案 > 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 提出这个建议,你认为这是个好主意吗?

如果不是,为什么?

标签: htmlsemantic-markup

解决方案


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

<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>

推荐阅读