三部分页脚应包含哪些 HTML5 标签

发布于 2024-12-18 01:42:33 字数 1245 浏览 2 评论 0 原文

我发现使用新的 HTML 5 标签使 HTML 的语义越丰富,文档的样式设置和使用就越容易。我是 HTML 5 的新手,而且只是一个 HTML 新手,但我想让我的 HTML 5 在语义上尽可能正确。目前我的 HTML 5 页脚像这样划分。

    <footer>
        <section>
            <h2>Contact</h2>
            <ul>
                <li><a href="snip">Email</a></li>
                <li><a href="snip">Tweet</a></li>
            </ul>
        </section>
        <section>
            <h2>Explore</h2>
            <ul>
                <li><a href="snip">Stack Overflow</a></li>
                <li><a href="snip">LinkedIn</a></li>
                <li><a href="snip">Flickr</a></li>
                <li><a href="snip">Google+</a></li>
            </ul>
        </section>
        <section>
            <h2>About</h2>
            <p>
               snip
            </p>
        </section>
    </footer>

我正在查询的特定标签是 h2 标签的部分和使用。我认为部分在语义上比旁白或文章更正确,因为页脚的每个部分都是一个部分。 h2 也是我关心的问题。我想使用 H1,因为它是本节中的第一个标题,但我担心如果我使用 h1 而不是 h2,谷歌蜘蛛会避开我并阻止我结交网络朋友。

非常感谢从事语义工作的人们的想法。

I am finding that the more semantic I make my HTML using the new HTML 5 tags the easier it is to style and work with the document. I am new to HTML 5 and only a HTML novice but I want to make my HTML 5 as semantically correct as possible. Currently I have my HTML 5 footer divided like so.

    <footer>
        <section>
            <h2>Contact</h2>
            <ul>
                <li><a href="snip">Email</a></li>
                <li><a href="snip">Tweet</a></li>
            </ul>
        </section>
        <section>
            <h2>Explore</h2>
            <ul>
                <li><a href="snip">Stack Overflow</a></li>
                <li><a href="snip">LinkedIn</a></li>
                <li><a href="snip">Flickr</a></li>
                <li><a href="snip">Google+</a></li>
            </ul>
        </section>
        <section>
            <h2>About</h2>
            <p>
               snip
            </p>
        </section>
    </footer>

The particular tags I am querying are section and use of the h2 tag. I would think section is more semantically correct that aside or article as each section of the footer is, well, a section. The h2 is also a concern to me. I would like to use H1 as it is the first heading in the section but I am afraid the google spider will shun me and keep me from making web friends if I use h1 over h2.

Thoughts from people who have worked with semantics are very much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人接听 2024-12-25 01:42:33

您可能需要在联系信息周围添加 address 标签:

<footer>
    <section>
        <h1>Contact</h1>
        <address>
            <ul>
                <li><a href="snip">Email</a></li>
                <li><a href="snip">Tweet</a></li>
            </ul>
        </address>
    </section>
    <section>
        <h1>Explore</h1>
        <ul>
            <li><a href="snip">Stack Overflow</a></li>
            <li><a href="snip">LinkedIn</a></li>
            <li><a href="snip">Flickr</a></li>
            <li><a href="snip">Google+</a></li>
        </ul>
    </section>
    <section>
        <h1>About</h1>
        <p>
           snip
        </p>
    </section>
</footer>

这在语义上是正确的,但请注意旧版浏览器在实现

时存在问题>。在 Firefox 3.6.12 中,不允许将块元素放置在

就像这里讨论的

编辑:
还将

更改为

请注意,使用section意味着作者可以在整个过程中使用h1元素,而不必担心特定部分是否位于顶层、第二层、第三层等等。

You may want to add the address-tag around your contact information:

<footer>
    <section>
        <h1>Contact</h1>
        <address>
            <ul>
                <li><a href="snip">Email</a></li>
                <li><a href="snip">Tweet</a></li>
            </ul>
        </address>
    </section>
    <section>
        <h1>Explore</h1>
        <ul>
            <li><a href="snip">Stack Overflow</a></li>
            <li><a href="snip">LinkedIn</a></li>
            <li><a href="snip">Flickr</a></li>
            <li><a href="snip">Google+</a></li>
        </ul>
    </section>
    <section>
        <h1>About</h1>
        <p>
           snip
        </p>
    </section>
</footer>

this would be semantically correct but watch out for older browsers which are having problems with the implementation of <address>. In Firefox 3.6.12 were no block-elements allowed to be placed inside <address> like discussed here.

EDIT:
Also change the <h2> to <h1>:

Notice how the use of section means that the author can use h1 elements throughout, without having to worry about whether a particular section is at the top level, the second level, the third level, and so on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文