如何根据 HTML5 语义命名 div?

发布于 2024-12-14 05:01:22 字数 157 浏览 2 评论 0原文

我有这个[已删除],我将使用 HTML5 和 CSS3 将其转换为 html。 内容区域中有所有这些段落,如何命名它们更好,我在哪里使用除了,你会怎么做?该照片实际上是一个幻灯片,其中包含来自 Flickr 的照片,通过 jQuery 从 JSON 提要中取出。

有这方面的相关文章吗?

I have this [deleted] which I am gonna transform in html, using HTML5 and CSS3.
Having all these paragraphs in the content area, how is it better to name them, where do I use aside, how would you do? The photo will actually be a slideshow with photos from Flickr, taken out of a JSON feed with jQuery.

Any relevant articles on this?

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

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

发布评论

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

评论(1

萧瑟寒风 2024-12-21 05:01:22

好吧,根据您的布局,我想说的是,尽可能多地使用 HTML5 原生语义元素:

  • 您的“徽标”文本绝对应该是标题。无论是

    还是较低级别的标题,都取决于您/您的网站结构。

  • 幻灯片可能应该单独放在
    中 - 没有真正适合它的 HTML 元素,并且尝试拉伸某些内容以使其超出其应有的值对语义来说是不好的。
  • 最后,看看主要部分,其中有一些可以细分的内容:
    • “关于”文本绝对应该是另一个标题,其数量低于“徽标”文本的数量。
    • “我们为功能而设计...”可能会封装在

      标记中。

    • 右侧的“Amazon Web Services”和“TYPO3”部分可能会放入

一般来说,最好的选择是跟随您的直觉,如果您仍然感到困惑,请快速检查完整的 HTML 元素列表,并查看 HTML 的众多标签是否正确描述了您的内容。

Well, based on your layout, I'd say just to use as many of the HTML5-native semantic elements as you can:

  • Your "logo" text should definitely be a header. Whether a <h1>, or a lower-level header, is up to you / your website structure.
  • The slideshow probably should just be on its own in a <div> - there's not really a good HTML element for it, and it's bad for semantics to try and stretch something to count for more than it should.
  • Finally, looking at the main section, there's a few things that can be broken down in there:
    • The "About" text should definitely be another header, lower in number than that of the "logo" text.
    • "We design for functionality..." could probably be encapsulated in a <blockquote> tag.
    • The "Amazon Web Services" and "TYPO3" sections on the right could probably be put into an <aside> tag, as they're not directly related to the rest of the "about" section.

Generally, the best call is just to go with your gut instinct, and if you're still confused, do a quick check through a full HTML-element listing, and see if any of HTML's many tags describe your content correctly.

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