将< articles放在< li> s内是一种好习惯吗? [英] Is it a good practice to put <article>s inside <li>s?

查看:96
本文介绍了将< articles放在< li> s内是一种好习惯吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常在博客的首页上,有几篇最近的博客文章,每篇博客文章都是< article> 。通常,博客评论也使用< article> s进行标记。

Typically on the front page of a blog, there are several recent blog posts, and each blog post is an <article>. And usually blog comments are markuped using <article>s, too.

我的问题是:将这些< article> 放入< li> s的良好实践?我以前这样做是因为在我自己的解释中,这些< article> 一起以一定的金额 / 数量。因此,当要列出一定数量/数量的元素时,< ul> < ol> 是最佳选择。

My question is: Is it a good practice to put those <article>s inside <li>s? I used to do that because in my own interpretation those <article>s together are presented in a way of a certain amount/quantity. So when it comes to listing a certain amount/quantity of elements, <ul> and <ol> are the best choices.

但是,也许我需要重新考虑我的解释,因为将< article> 放在< li> 似乎是对< li> 的滥用。我也想考虑可访问性。我不确定这样做是否会引起辅助技术的混乱。

However, maybe I need to reconsider my interpretation because putting <article>s inside <li>s seems to be a misuse of <li>. And I also want to take accessibility into account. I'm not sure if doing that causes confusions to assistive technologies or not.

推荐答案

问题的实质归结为:什么构成一个列表?如果是文章列表,则应使用< li> 进行标记。屏幕阅读器用户的优势在于,屏幕阅读器可以使用语义标记来传达有用的信息。例如,通知用户他们刚刚进入了 5个项目的列表,可以帮助他们了解内容的组织方式以及其中的内容。

The question really comes down to: What constitutes a list? If it's a list of articles, then it should be marked up as such using <li>. The advantage for screen reader users is that screen readers can use the semantic markup to communicate useful information. For example, informing the user that they've just landed on a "list of 5 items" helps them to understand how the content is organized, and how much of it there is.

也就是说,如果列表中的每个项目都很长或包含包含许多嵌套元素的复杂内容,我同意@IanY,这可能会造成混淆,因为这样用户很难跟踪它们在其中的位置

That said, if each item in the list is very long or contains complex content with lots of nested elements, I agree @IanY that this could be confusing, as it then becomes difficult for users to keep track of where they are within the list.

当内容块相对较大时,如果有视力的用户不太可能看该内容并将其标识为项目列表,则您不应使用< li> 。如果您使用< article> 和标题标记文章标题,则可以提供足够的语义以方便屏幕阅读器用户导航。

When blocks of content are relatively large, if a sighted user isn't likely to look at that content and identify it as a list of items, then you shouldn't use <li>. If you use <article> and a heading to mark the article title, that provides a sufficient amount of semantics to facilitate navigation for screen reader users.

这篇关于将&lt; articles放在&lt; li&gt; s内是一种好习惯吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆