html - 使用 <ul> 和 <li> 设置选项卡样式与在 <div> 内使用纯 <div> 相比有什么优势?

标签 html css tabs

我认为标签经常被实现为 <ul>和一系列 <li>里面。有没有优势 只使用 <div>有几个<div>在里面吗?

通常使用 <ul>作为制表符,它的 padding-left 需要重置为 0,并且 list-style需要设置为none , 而 <div>没有这个问题。

最佳答案

简短而明确的答案:Why should I use 'li' instead of 'div'?

摘录:

"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."

"For the visually impaired, it can be helpful to distinguish what's in a list and what's not. Say if you have a list of ingredients in a recipe for example, and the user wants to skip to the instructions or just read the list, you need a list."

不要忘记访问链接以了解更多信息。

关于html - 使用 <ul> 和 <li> 设置选项卡样式与在 <div> 内使用纯 <div> 相比有什么优势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5544392/

相关文章:

css - 钛的 ScrollView 有问题吗?

jquery - 直接链接到表格选项卡

jquery - 循环中 chrome.tabs.create 的错误

ios - 在标签IOS之间跳转时ViewController变为空白

HTML5 Flexbox 可以在两个轴上拉伸(stretch)吗?

Html 表格按钮占用太多空间

javascript - 如何在没有定位的情况下对元素使用 CSS 过渡

javascript - jquery 下拉列表

javascript - Tinymce 文本颜色

php - MySQL 存储关系(家族)树