有没有更好的方法在 XHTML 1.0 Transitional 中对 FAQ 进行语义编码?

Is there a better way to semantically code up an FAQ in XHTML 1.0 Transitional?

FAQ 的以下代码段使用 XHTML 1.0,无法在 W3C validator 中成功验证。

我将问答插入到定义列表中,以便在语义上维护问答关系。问题是,问题可以是多个段落。 <dt> 标签,至少在 XHTML 1.0 中,只允许内联元素。所以我不能在其中放置 <p> 标签而不在 W3C 验证器中抛出错误。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<dl>
    <dt>
        <p>This is a very long question.</p>
        <p>It has multiple paragraphs.</p>
    </dt>

    <dd>
        <p>This is the answer</p>
    </dd>
</dl>
</body>
</html>

是否有语义更好的方法来使用 XHMTL 1.0 Transitional 对此进行编码?

作为参考,我能找到的关于该主题的最新类似帖子是 What is the best way to semanticly structure a FAQ?。该线程很有用,但是它没有涵盖问题中的多个段落。

使用 dl 元素似乎不合适。

XHTML 1.0 uses the element definitions from HTML 4.01, where the dl element 被定义为 "definition list"。问答列表可能不是 定义 列表(除非,也许,要定义的术语只是问题的措辞,例如 "What is the definition of foo?")。

HTML5 re-defines dl element: it’s no longer a definition list, but an "association list", or "description list". It might be appropriate to use it for Q&As, and the dt element can now also contain most of the flow content elements (which includes p). So this might be suitable if you want to use (X)HTML5. (The example for dt 甚至显示了常见问题解答。)

可能的替代方案,取决于实际内容和上下文:

  • 只需使用 p 并依赖文本语义,即“?”明确这是一个问题。您还可以在它们前面加上 "Question:" 和 "Answer:"(例如,在 b 中)。
  • 为每个问答使用标题 (h1-h6)。由于它们都可能不包含 p 元素,您可能必须使用类似 "Question 1" 的内容作为标题内容,并再次依赖文本。