打造最美打造最美CSS多级下拉横向导航菜单代码多级下拉横向导航菜单代码
主要告诉大家如何打造最美CSS多级下拉横向导航菜单效果,具有一定的参考价值,感兴趣的小伙伴们可以参考
一下
本文实例为大家分享了纯CSS实现多级下拉横向导航菜单代码,供大家参考,具体内容如下
先看看效果图:
实现代码:实现代码:
CSS代码:代码:
CSS Code复制内容到剪贴板
1. <style type="text/css">
2. /* for this demo only */
3. #backgroundHolder { width:750px; height:500px; padding-top:10px; margin:0 auto; }
4. /* ---------------------------------------------------------------------------- */
5. /* default styling */
6. .nav, .nav ul { list-style-type:none; margin:0; padding:0; }
7. .nav a { text-decoration:none; }
8. .nav { font-family: arial, sans-serif; font-size:12px; width:650px; margin:0 auto; }
9. /* style the links */
10. .nav a { background:url(ulmulti3/box.gif) no-repeat rightright center; }
11. .nav a.top { background:url(ulmulti3/box.gif) no-repeat rightright top; }
12. .nav a.top2 { background:url(ulmulti3/box2.gif) no-repeat rightright top; }
13. .nav a.bottombottom { background:url(ulmulti3/box.gif) no-repeat rightright bottombottom; }
14. .rightright ul ul a { background:url(ulmulti3/box3.gif) no-repeat rightright center; }
15. .rightright ul ul a.top2 { background:url(ulmulti3/box3.gif) no-repeat rightright top; }
16. .rightright ul ul a.bottombottom { background:url(ulmulti3/box3.gif) no-repeat rightright bottombottom; }
17. /* style the element so that is does not affect the size of the link */
18. .nav a b { color:#fff; font-weight:normal; display:block; padding:5px 10px 5px 15px; }
19. .nav .fly .main b { background: transparent url(ulmulti3/arrow.gif) no-repeat 117px 9px; }
20. .nav .down b { background: transparent url(ulmulti3/arrow2.gif) no-repeat 115px 11px; }
21. .nav .rightright ul b { text-align:rightright; }
22. .nav .rightright ul ul b { padding: 5px 15px 5px 10px; }
23. .nav .rightright ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 15px 9px; text-align:rightright; }
24. .nav .rightright ul ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 5px 9px; text-align:rightright; }
25. /* HEIGHT */
26. .nav ul ul { top:-24px; } /* position the top of the flyout first sub menus */
27. .nav ul ul ul { top:-25px; } /* position the top of the flyout second and third sub menus */
28. .nav ul.two { top:-40px; } /* position the top of the flyout sub menus with previous text on two lines */
29. /* WIDTH change this WITH CARE to suit your requirements */
30.
31. /*set the link width here*/
32. .nav .drop, .nav a { width:130px; }
33. .nav ul li { max-width:130px; } /* fix for IE8 */
34. /* set the left flyout position here */
35. .nav ul ul { left:130px; }
36. /* set the right flyout position here */
37. .nav li.rightright ul ul { left:auto; rightright:120px; }
38. .nav li.rightright ul ul ul { left:auto; rightright:130px; }
39. /* make this WIDTH - 1px */ /* or WIDTH - 0.063em if using em sizing */