是否有 HTML5 标签来表示文章预览?

发布于 2024-12-13 11:58:13 字数 307 浏览 2 评论 0原文

文章元素的描述如下:

article 元素表示页面的一个组件,该组件由以下部分组成 文档、页面、应用程序或站点中的独立组成部分 并且旨在可独立分发或可重复使用, 例如在联合组织中。这可以是论坛帖子、杂志或 报纸文章、博客条目、用户提交的评论、 交互式小部件或小工具,或任何其他独立项目 内容。

但是,我有兴趣显示将包含在文章元素中的一些内容的预览。它不是文章本身,而是文章的链接,包含一些内容。在 HTML5 中是否有一种语义方式来表达这一点,或者 div 是否合适?

The description for an article element read:

The article element represents a component of a page that consists of
a self-contained composition in a document, page, application, or site
and that is intended to be independently distributable or reusable,
e.g. in syndication. This could be a forum post, a magazine or
newspaper article, a blog entry, a user-submitted comment, an
interactive widget or gadget, or any other independent item of
content.

However, I'm interested in showing a preview of some content that will be wrapped in an article element. It isn't the article itself, but is a link to the article and contains some of the content. Is there a semantic way of expressing this in HTML5, or would divs be appropriate?

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

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

发布评论

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

评论(2

ヤ经典坏疍 2024-12-20 11:58:13

没有专门用于预览摘录的 HTML5 标记。

可以说,一篇文章的摘要是一个独立的、可能可重用/联合的内容,因此您可能可以使用

否则,

总是可以的,尽管您可能会根据上下文考虑

或列表。

要标记实际的预览文本,您可以使用

,当您引用该文章时。

There is no HTML5 tag specifically for preview excerpts.

Arguably, a summary of an article is a self-contained, potentially-reusable/syndicate-able bit of content, so you’d probably be fine using <article> for it.

Otherwise, <div> is always fine, although you might consider <section> or a list depending on the context.

To mark up the actual preview text, you could use <blockquote>, as you’re quoting the article.

快乐很简单 2024-12-20 11:58:13

nav 可能会很方便,但它有可能变得矫枉过正,因为它在大纲中创建了一个部分。人们还可以考虑使用figure,特别是当摘录也有缩略图时。

nav may be come handy, but it risks becoming overkill, as it creates a section in the outline. One may also consider using figure, especially if the excerpt also has a thumbnail.

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