更正有序列表中标题的HTML5标记

时间:2013-09-06 17:41:38

标签: html

我的内容如下。 (我只包括前3个中的2个)。

1 
Get in touch
Get in touch with us to discuss your requirements.

2
Choose a service
One of our agents will aid you in choosing from our range of services. 

换句话说:

Number
Heading
Text

我该如何标记?我认为这应该是一个有序的清单。我可以在有序列表中添加标题吗?

1 个答案:

答案 0 :(得分:3)

是的,你可以。您将标题放在列表项中,然后在同一个列表项中放置后面的任何段落(我只是以<h2>为例):

<ol>
    <li>
        <h2>Get in touch</h2>
        <p>Get in touch with us to discuss your requirements.</p>
    </li>
    <li>
        <h2>Choose a service</h2>
        <p>One of our agents will aid you in choosing from our range of services.</p>
    </li>
    <li>
        <!-- Third item -->
    </li>
</ol>

标题需要驻留在列表项中,而不是直接位于有序列表中,以使标记有效。考虑到你想要的结果,这也是有意义的。