Why use list to do navigation menu instead of buttons?

拜拜、爱过 提交于 2020-01-10 05:16:06

问题


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.


回答1:


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.




回答2:


Generally lists are used for navigation items in HTML because they are presenting a list of navigation options to the user.

HTML5 offers a bit more semantic precision using menu and nav




回答3:


The semantics of a list make it look more like a grouped section, that's all I can think of. There is no real (dis)advantage for using list items over other methods of defining a menu.



来源:https://stackoverflow.com/questions/5622220/why-use-list-to-do-navigation-menu-instead-of-buttons

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