Which semantics is better for a list of articles?

扶醉桌前 提交于 2019-11-28 14:15:08

ol must only be used if "changing the order would change the meaning". Just because content is sorted somehow doesn’t necessarily mean that ol is appropriate.

If you should use a list (whether ol or ul) depends on your actual content and its context, it can’t be answered generally. The HTML5 spec defines these lists as "list of items", without specifying what a list is or what qualifies as item.

A possible/subjective rule of thumb (with many exceptions): Look at your content and ask yourself if you would call it a list, and if you could picture it with typical bullet points.

A page, titled "Blog", showing 10 fulltext blog posts? Probably not.
A sidebar, titled "Related posts", showing 10 links to blog posts? Probably yes.

This suggests that the "complexity" of content might play a role, too, so another possible/subjective rule of thumb (with even more exceptions): If an item has a heading (i.e., it’s a section) and long content, you might not need a list.

Steps to use a product, where each step consists of long explanations with images? Probably not.
Steps to use a product, where each step consists of a short sentence? Probably yes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!