在线消息:< ul>与< ol>与< div> [英] Online Messaging: <ul> vs <ol> vs <div>

查看:58
本文介绍了在线消息:< ul>与< ol>与< div>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正忙于编写在线聊天,尽管使用哪个并不重要,但是由于可以使用CSS设置样式,因此我想使用最好的标记来标记消息.

I'm busy writing an online chat, and although it doesn't really matter which I use, since I can style them however I want with CSS, I'd quite like to use the best tag for messages.

我的第一个想法是使用< ol> ,因为消息是按时间排序的.但是,Facebook使用< ul> s,而Google聊天使用< div> s.Twitter确实使用< ol> .

My first thought was to use an <ol> since the messages are ordered by time. However, Facebook uses <ul>s and Google chat uses <div>s. Twitter does use <ol>.

那么,哪个在语义上正确?而且,哪种方式最适合使用屏幕阅读器的用户?

So, which is semantically correct? And, which would be best for user with screen readers?

推荐答案

div .< ul>< ol> 是列表.聊天消息没有排序列表,这很明显.如果您在每封邮件附近都不需要项目符号/圆点/其他标记-它们也不是无序列表.

div only. <ul><ol> are lists. Chat messages are not ordered list, it is obvious. If you dont need bullets/dots/other marker near each message - they are not unordered list too.

还使用 div ,您无需重置列表的默认样式,只需编写更少的CSS代码即可.

Also using div you dont need to reset default styles for lists = less CSS code you will write.

这篇关于在线消息:&lt; ul&gt;与&lt; ol&gt;与&lt; div&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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