我为什么要用'li'代替'div'? [英] Why should I use 'li' instead of 'div'?

查看:124
本文介绍了我为什么要用'li'代替'div'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定为什么我需要使用ul-li而不是简单地使用div来列出项目。我可以让两者看起来完全一样,所以创建一个无序列表的功能优势与排列divs是否一样? 为解决方案

语义正确性。 HTML能够表达事物清单,并且它可以帮助Google机器人,屏幕阅读器以及所有不关心网站演示的用户更好地理解您的内容。

I'm not sure why I need to use ul-li vs simply using divs when listing items. I can make both look exactly the same so where is the functional advantage to creating an unordered list vs lining up divs?

解决方案

For semantic correctness. HTML has the ability to express lists of things, and it helps the Google robot, screen readers, and all manner of users who don't care solely about the presentation of the site understand your content better.

这篇关于我为什么要用'li'代替'div'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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