What is the best way to display a drop down menu?

妖精的绣舞 提交于 2020-01-06 03:03:14

问题


What is the best way to display a drop down menu? for the sake of best practices.
keeping in mind:

-Accessabilty , Its viewable with javascript off
screen readers -backwords capatabilty , viewable in IE6 -cross browser

I'm asking this because I've recently been working on some site that have css only drop down menu's that do not display the drop downs in IE6

Is displaying the drop down as a list if javascript is off the right way to do it?


回答1:


The standard for javascriptless dropdown are called suckerfish or son of suckerfish dropdowns: http://htmldog.com/articles/suckerfish/dropdowns/

In IE6, though, as you'll notice, they use a little bit of js to mimic hover. That's fine--so long as the first link you hover over, that triggers the dropdown, is a real link! Have that link go to a page where they can navigate to those pages hidden in the menu. If nothing else, simply copying the submenu they're missing and making that the content of the page will work.

Voila, accessibility.




回答2:


If you must ensure, it's viewable with JS turned off, go with a CSS-solution. Here's one that claims to be cross-browser:

http://lwis.net/free-css-drop-down-menu/

even though it uses a little JS for IE6 (and older).

Or maybe setup your own, using this tutorial:

http://ago.tanfa.co.uk/css/examples/menu/tutorial-h.html



来源:https://stackoverflow.com/questions/2362530/what-is-the-best-way-to-display-a-drop-down-menu

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