为什么使用列表而不是按钮来做导航菜单?
我查看了互联网上的许多导航菜单,它们通常使用列表而不是按钮.这背后的原因是什么?为什么要使用按钮?谢谢.
I have inspected many navigation menus on the internet, and they often use lists instead of a button. What is the reason behind this? Why use the button? Thank you.
推荐答案
使用列表有(至少)两个很好的理由.使用列表可以帮助您了解您的网站结构,这在 SEO 方面是好的,但如果人们出于可访问性原因使用自定义 CSS 或屏幕阅读器,也是如此.第二个稍微相关的一点是,它在创建样式表时很有帮助.您不需要想出自己的嵌套元素方式.只需使用列表并从那里开始.然后,您可以专注于让样式表正确,为不同的层次结构级别、第一个、最后一个、奇数或偶数列表项提供不同的样式.
There are (at least) two good reasons to use lists. Using lists can help to give an idea of your site's structure which is good in terms of SEO but also if people use either custom CSS or screen readers for accessibility reasons. The second and slightly related one is that it's rather helpful when it comes to creating stylesheets. You don't need to come up with your own way of nesting elements. Just use lists and go from there. Then you can focus on getting the stylesheet right providing different styles for different hierarchy levels, first, last, odd or even list items.
相关文章