問題描述
我查看了互聯(lián)網(wǎng)上的許多導(dǎo)航菜單,它們通常使用列表而不是按鈕.這背后的原因是什么?為什么要使用按鈕?謝謝.
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.
推薦答案
使用列表有(至少)兩個(gè)很好的理由.使用列表可以幫助您了解您的網(wǎng)站結(jié)構(gòu),這在 SEO 方面是好的,但如果人們出于可訪問性原因使用自定義 CSS 或屏幕閱讀器,也是如此.第二個(gè)稍微相關(guān)的一點(diǎn)是,它在創(chuàng)建樣式表時(shí)很有幫助.您不需要想出自己的嵌套元素方式.只需使用列表并從那里開始.然后,您可以專注于讓樣式表正確,為不同的層次結(jié)構(gòu)級(jí)別、第一個(gè)、最后一個(gè)、奇數(shù)或偶數(shù)列表項(xiàng)提供不同的樣式.
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.
這篇關(guān)于為什么使用列表而不是按鈕來做導(dǎo)航菜單?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!