本文实例为大家分享了纯CSS实现多级下拉横向导航菜单代码,供大家参考,具体内容如下
先看看效果图:
实现代码:
CSS代码:
CSS Code复制内容到剪贴板- <style type="text/css">
- /* for this demo only */
- #backgroundHolder { width:750px; height:500px; padding-top:10px; margin:0 auto; }
- /* ---------------------------------------------------------------------------- */
- /* default styling */
- .nav, .nav ul { list-style-type:none; margin:0; padding:0; }
- .nav a { text-decoration:none; }
- .nav { font-family: arial, sans-serif; font-size:12px; width:650px; margin:0 auto; }
- /* style the links */
- .nav a { background:url(ulmulti3/box.gif) no-repeat rightright center; }
- .nav a.top { background:url(ulmulti3/box.gif) no-repeat rightright top; }
- .nav a.top2 { background:url(ulmulti3/box2.gif) no-repeat rightright top; }
- .nav a.bottombottom { background:url(ulmulti3/box.gif) no-repeat rightright bottombottom; }
- .rightright ul ul a { background:url(ulmulti3/box3.gif) no-repeat rightright center; }
- .rightright ul ul a.top2 { background:url(ulmulti3/box3.gif) no-repeat rightright top; }
- .rightright ul ul a.bottombottom { background:url(ulmulti3/box3.gif) no-repeat rightright bottombottom; }
- /* style the <b> element so that is does not affect the size of the link */
- .nav a b { color:#fff; font-weight:normal; display:block; padding:5px 10px 5px 15px; }
- .nav .fly .main b { background: transparent url(ulmulti3/arrow.gif) no-repeat 117px 9px; }
- .nav .down b { background: transparent url(ulmulti3/arrow2.gif) no-repeat 115px 11px; }
- .nav .rightright ul b { text-align:rightright; }
- .nav .rightright ul ul b { padding: 5px 15px 5px 10px; }
- .nav .rightright ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 15px 9px; text-align:rightright; }
- .nav .rightright ul ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 5px 9px; text-align:rightright; }
- /* HEIGHT */
- .nav ul ul { top:-24px; } /* position the top of the flyout first sub menus */
- .nav ul ul ul { top:-25px; } /* position the top of the flyout second and third sub menus */
- .nav ul.two { top:-40px; } /* position the top of the flyout sub menus with previous text on two lines */
- /* WIDTH change this WITH CARE to suit your requirements */
- /*set the link width here*/
- .nav .drop, .nav a { width:130px; }
- .nav ul li { max-width:130px; } /* fix for IE8 */
- /* set the left flyout position here */
- .nav ul ul { left:130px; }
- /* set the right flyout position here */
- .nav li.rightright ul ul { left:auto; rightright:120px; }
- .nav li.rightright ul ul ul { left:auto; rightright:130px; }
- /* make this WIDTH - 1px */ /* or WIDTH - 0.063em if using em sizing */
- .nav a { margin-right:-129px; }
- /* ---------------------------------------------------------------------------- */
- /* DO NOT CHANGE ANYTHING BELOW */
- .nav li { float:left; } /* fixes IE bugs, and allows for clearing */
- .nav ul { float:left; position:relative; z-index:20; } /* necessary for float drop and to stack the <ul>s */
- .nav ul li { clear:left; } /* must clear the floated list item inside sublist */
- .nav a { position:relative; display:block; } /* needs to have a position, to be above the rest */
- .nav a.main { float:left; /* necessary for float drop */ margin-top:10000px; } /* bring the top level links back into view */
- .nav .drop, .nav .fly { margin-top:-10000px; } /* hide the sub links and their containers, opera has low upper limits */
- .nav ul { margin-bottom:-5000px; } /* avoid any interaction between the subs, can be any large size */
- /* The bit that does ALL the work to bring the sub menus into view */
- .nav a:hover, .nav a:focus, .nav a:active { margin-right:0; z-index:10; outline:0; }
- .nav a:hover b, .nav a:focus b, .nav a:active b { color:#000; cursor:pointer; } /* this is for keyboard tabbing color change */
- /* OPERA fix */
- .nav ul:hover, .nav ul ul:hover { clear:left; } /* to stop intermittent sub link :hover problems */
- /* ---------------------------------------------------------------------------- */
- </style>
- <!--[if lte IE 7]>
- <style type="text/css">
- /* bug fixes for IE7 and lower - DO NOT CHANGE */
- .nav .fly {width:99%;} /* make each flyout 99% of the prevous level */
- a:active {} /* requires a blank style for :active to stop it being buggy */
- </style>
html代码:
XML/HTML Code复制内容到剪贴板- <body>
- <div id="backgroundHolder">
- <ul class="nav">
- <li class="drop"><a class="main top" href="#url"><b>Home</b></a></li>
- <li class="drop"><a class="main down top" href="#url"><b>Equipment</b></a>
- <ul>
- <li class="fly"><a class="main" href="#url"><b>Cameras</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Film Type</b></a></li>
- <li><a href="#url"><b>Compact</b></a></li>
- <li><a href="#url"><b>Polaroid</b></a></li>
- <li><a href="#url"><b>Digital</b></a></li>
- <li class="fly"><a class="main" href="#url"><b>Digital SLR</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Nikon</b></a></li>
- <li><a href="#url"><b>Panasonic</b></a></li>
- <li><a class="bottom" href="#url"><b>Kodak</b></a></li>
- </ul>
- </li>
- <li><a class="bottom" href="#url"><b>Second Hand</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Video Cameras & Accessories</b></a>
- <ul class="two">
- <li class="fly"><a class="main top2" href="#url"><b>Latest Models</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Nikon</b></a></li>
- <li><a href="#url"><b>Panasonic</b></a></li>
- <li><a href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a class="bottom" href="#url"><b>Minolta</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Special Offers</b></a></li>
- <li><a class="bottom" href="#url"><b>Professional</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Lenses</b></a>
- <ul>
- <li class="fly"><a class="main top2" href="#url"><b>Digital</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Standard</b></a></li>
- <li><a href="#url"><b>Telephoto</b></a></li>
- <li><a href="#url"><b>Wide Angle</b></a></li>
- <li class="fly"><a class="main" href="#url"><b>Zoom</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Nikon</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a href="#url"><b>Minolta</b></a></li>
- <li><a class="bottom" href="#url"><b>Panasonic</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Zoom with Macro</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Panasonic</b></a></li>
- <li><a href="#url"><b>Minolta</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a href="#url"><b>Canon</b></a></li>
- <li><a class="bottom" href="#url"><b>Nikon</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Fisheye</b></a></li>
- <li><a class="bottom" href="#url"><b>x2 converters</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Standard SLR</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Nikon</b></a></li>
- <li><a href="#url"><b>Panasonic</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a class="bottom" href="#url"><b>Minolta</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Cases</b></a></li>
- <li class="fly"><a class="main" href="#url"><b>Large Format</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Hasselblad</b></a></li>
- <li><a href="#url"><b>Arca-Swiss</b></a></li>
- <li><a class="bottom" href="#url"><b>Leica</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Lens Hoods</b></a></li>
- <li><a class="bottom" href="#url"><b>Lens Cleaners</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Tripods</b></a></li>
- <li><a href="#url"><b>Flashguns</b></a></li>
- <li><a href="#url"><b>Accessories, filters & lens covers</b></a></li>
- <li><a href="#url"><b>Special Offers</b></a></li>
- <li><a class="bottom" href="#url"><b>Electronics</b></a></li>
- </ul>
- </li>
- <li class="drop"><a class="main down top" href="#url"><b>Accessories</b></a>
- <ul>
- <li class="fly"><a class="main" href="#url"><b>Flashguns</b></a>
- <ul>
- <li class="fly"><a class="main top2" href="#url"><b>Digital Cameras</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Nikon</b></a></li>
- <li><a href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Panasonic</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a class="bottom" href="#url"><b>Kodak</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Film Cameras</b></a></li>
- <li><a href="#url"><b>Reflectors</b></a></li>
- <li><a href="#url"><b>Stands</b></a></li>
- <li><a href="#url"><b>Remote Control</b></a></li>
- <li><a class="bottom" href="#url"><b>Batteries</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Filters</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Ultra Violet</b></a></li>
- <li><a href="#url"><b>Lens protection</b></a></li>
- <li><a href="#url"><b>Yellow</b></a></li>
- <li><a href="#url"><b>Red</b></a></li>
- <li><a href="#url"><b>Orange</b></a></li>
- <li><a class="bottom" href="#url"><b>Blue</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Remote Control</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Nikon</b></a></li>
- <li><a class="bottom" href="#url"><b>Pentax</b></a></li>
- </ul>
- </li>
- <li class="fly"><a class="main" href="#url"><b>Camera Cases</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Pentax</b></a></li>
- <li><a href="#url"><b>Nikox</b></a></li>
- <li><a href="#url"><b>Canon</b></a></li>
- <li><a href="#url"><b>Pentax</b></a></li>
- <li><a href="#url"><b>Kodak</b></a></li>
- <li><a class="bottom" href="#url"><b>Minolta</b></a></li>
- </ul>
- </li>
- <li><a class="bottom" href="#url"><b>Lens Brush</b></a></li>
- </ul>
- </li>
- <li class="drop right"><a class="main down top" href="#url"><b>Outlets</b></a>
- <ul>
- <li><a href="#url"><b>Support</b></a></li>
- <li><a href="#url"><b>Buying</b></a></li>
- <li><a href="#url"><b>Photographers</b></a></li>
- <li class="fly"><a class="main" href="#url"><b>Stockist</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Currys</b></a></li>
- <li><a href="#url"><b>Dixons</b></a></li>
- <li><a href="#url"><b>Jessops</b></a></li>
- <li><a class="bottom" href="#url"><b>Staples</b></a></li>
- </ul>
- </li>
- <li><a href="#5"><b>General</b></a></li>
- <li class="fly"><a class="main bottom" href="#url"><b>Sales</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>USA</b></a></li>
- <li><a href="#url"><b>CANADA</b></a></li>
- <li><a href="#url"><b>South America</b></a></li>
- <li class="fly"><a class="main" href="#url"><b>Europe</b></a>
- <ul>
- <li><a class="top2" href="#url"><b>Britain</b></a></li>
- <li><a href="#url"><b>France</b></a></li>
- <li><a href="#url"><b>Germany</b></a></li>
- <li><a href="#url"><b>Spain</b></a></li>
- <li><a class="bottom" href="#url"><b>Italy</b></a></li>
- </ul>
- </li>
- <li><a href="#url"><b>Australia</b></a></li>
- <li><a class="bottom" href="#url"><b>Asia</b></a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="drop"><a class="main top" href="#url"><b>Privacy Policy</b></a></li>
- </ul>
- </div>
- <br>
- <br>
- <div align="center"> </div>
- </body>
源码下载:CSS多级下拉横向导航菜单
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“打造最美CSS多级下拉横向导航菜单代码”评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新动态
2024年11月24日
2024年11月24日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]