Online Messaging: <ul> vs <ol> vs <div>

孤街浪徒 提交于 2020-01-04 00:10:11

问题


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.

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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/15966272/online-messaging-ul-vs-ol-vs-div

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