- Mar 22, 2013
- 9,150
- 10,490
I tried doing it myself, but everything i attempted failed...
Basically i just finished installing and styling a 4-level drop-down navigation bar. It's the most complex CSS/HTML i've done until now. But i did ok and it didn't take too long either, which is good...
The one thing i didn't manage to do is set an Active state for the tabs. So for example if a user is on the Home Page of the blog, i want the "Home Page" tab on the nav bar to have a different effect than the rest of them...
p.s I don't particularly care about doing it for the drop-down tabs (unless it's simple). I just want the first level tabs to have an active state.
Here are my codes (I've highlighted all the First Level Tabs in Red):
HTML:
CSS:
If anyone could help me out i'd appreciate it. Thanks
Basically i just finished installing and styling a 4-level drop-down navigation bar. It's the most complex CSS/HTML i've done until now. But i did ok and it didn't take too long either, which is good...
The one thing i didn't manage to do is set an Active state for the tabs. So for example if a user is on the Home Page of the blog, i want the "Home Page" tab on the nav bar to have a different effect than the rest of them...
p.s I don't particularly care about doing it for the drop-down tabs (unless it's simple). I just want the first level tabs to have an active state.
Here are my codes (I've highlighted all the First Level Tabs in Red):
HTML:
Code:
[B] <div id="menu">[/B]
[B]<ul class="level1">
[/B]
[B][COLOR=#ff0000]<li class="level1-li"><a class="level1-a" href="#url">Home</a></li>[/COLOR]
[/B]
[COLOR=#ff0000][B]<li class="level1-li"><a class="level1-a fly" href="#url">Contact Us<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[/COLOR]
[COLOR=#ff0000][B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B][/COLOR]
[B]<ul class="level2">[/B]
[B]<li><a href="#url">Email</a></li>[/B]
[B]<li><a href="#url">Telephone</a></li>[/B]
[B]<li><a href="#url">Online Form</a></li>[/B]
[B]<li><a href="#url">Snail Mail Address</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
[/B]
[COLOR=#ff0000][B]<li class="level1-li"><a class="level1-a fly" href="#url">Resort<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[/COLOR]
[COLOR=#ff0000][B]<!--[if lte IE 6]><table><tr><td><![endif]-->[/B][/COLOR]
[B]<ul class="level2">[/B]
[B]<li><a href="#url">Ski Hire Facilities</a></li>[/B]
[B]<li><a class="fly" href="#url">Main Ski Slopes<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level3">[/B]
[B]<li><a href="#url">Beginners Slopes</a></li>[/B]
[B]<li><a href="#url">Intermediate Slopes</a></li>[/B]
[B]<li><a class="fly" href="#url">Advanced Skill Levels<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level4">[/B]
[B]<li><a href="#url">Local</a></li>[/B]
[B]<li><a href="#url">Nearby</a></li>[/B]
[B]<li><a href="#url">With instructor</a></li>[/B]
[B]<li><a href="#url">Snow boarding</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a href="#url">Expert</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a href="#url">Night Life</a></li>[/B]
[B]<li><a class="fly" href="#url">Restaurants<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B]<!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level3">[/B]
[B]<li><a href="#url">Snow Hotel</a></li>[/B]
[B]<li><a href="#url">The Snowman</a></li>[/B]
[B]<li><a href="#url">Ice Cavern</a></li>[/B]
[B]<li><a href="#url">Ski Inn</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a class="fly" href="#url">Car Hire<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level3">[/B]
[B]<li><a href="#url">From Airport</a></li>[/B]
[B]<li><a href="#url">In Resort</a></li>[/B]
[B]<li><a href="#url">Multiple Resorts</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
[/B]
[COLOR=#ff0000][B]<li class="level1-li"><a class="level1-a fly" href="#url">Surrounding Area<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[/COLOR]
[COLOR=#ff0000][B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B][/COLOR]
[B]<ul class="level2">[/B]
[B]<li><a href="#url">Where to go</a></li>[/B]
[B]<li><a href="#url">What to do</a></li>[/B]
[B]<li><a href="#url">Places of interest</a></li>[/B]
[B]<li><a href="#url">National parks & Museums</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
[/B]
[COLOR=#ff0000][B]<li class="level1-li left"><a class="level1-a fly" href="#url">Information<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[/COLOR]
[COLOR=#ff0000][B]<!--[if lte IE 6]><table><tr><td><![endif]-->[/B][/COLOR]
[B]<ul class="level2">[/B]
[B]<li><a href="#url">Money Exchange</a></li>[/B]
[B]<li><a class="fly" href="#url">Resort Essential Information<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level3">[/B]
[B]<li><a href="#url">Lift Passes</a></li>[/B]
[B]<li><a href="#url">Insurance</a></li>[/B]
[B]<li><a class="fly" href="#url">Gear Rental<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level4">[/B]
[B]<li><a href="#url">Boots</a></li>[/B]
[B]<li><a href="#url">Skis</a></li>[/B]
[B]<li><a href="#url">Ski Wear</a></li>[/B]
[B]<li><a href="#url">Goggles</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a href="#url">Ski Schools</a></li>[/B]
[B]<li><a href="#url">Snow Report</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a class="fly" href="#url">Language<!--[if gte IE 7]><!--></a><!--<![endif]-->[/B]
[B] <!--[if lte IE 6]><table><tr><td><![endif]-->[/B]
[B]<ul class="level3">[/B]
[B]<li><a href="#url">Austrian</a></li>[/B]
[B]<li><a href="#url">German</a></li>[/B]
[B]<li><a href="#url">French</a></li>[/B]
[B]<li><a href="#url">English</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[B]<li><a href="#url">Short Breaks</a></li>[/B]
[B]</ul>[/B]
[B]<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>[/B]
[COLOR=#ff0000][B]<li class="level1-li"><a class="level1-a" href="#url">Privacy</a></li>[/B][/COLOR]
[B]</ul>[/B]
[B]</div> [/B]
CSS:
Code:
[B]/* ================================================================ [/B]
[B]This copyright notice must be kept untouched in the stylesheet at all times. The original version of this stylesheet and the associated (x)html is available at [URL]http://www.cssplay.co.uk/menus/anywidth2.html[/URL][/B]
[B]Copyright (c) 2005-2009 Stu Nicholls. All rights reserved. This stylesheet and the associated (x)html may be modified in any way to fit your requirements.[/B]
[B]=================================================================== */[/B]
[B]#menu {width:740px; background: #3aa3d3; height:25px; text-align:center; position:relative; z-index:20;}[/B]
[B]#menu ul {margin:0; padding:0; list-style:none; white-space:nowrap; text-align:left;}[/B]
[B]#menu ul {display:inline-block;}[/B]
[B]#menu li {margin:0; padding:0; list-style:none;}[/B]
[B]#menu li {clear:both;float:none;}[/B]
[B]#menu ul ul {position:absolute; left:-9999px;}[/B]
[B]#menu ul.level1 {margin:0 auto;}[/B]
[B]#menu ul.level1 li.level1-li {float:left; display:block; position:relative;clear:none;}[/B]
[B]#menu ul.level1 {background:#3aa3d3;}[/B]
[B]#menu ul.level2 {background:#ae4621;}[/B]
[B]#menu ul.level3 {background:#c98b14;}[/B]
[B]#menu ul.level4 {background:#9f690e;}[/B]
[B]#menu b {position:absolute;} /* -- for IE6 non-flyout dropdowns to stop flickering - who knows why --*/[/B]
[B]#menu a {display:block; font:normal 11px verdana,arial,sans-serif; color:#fff; line-height:25px; text-decoration:none;padding:0 15px 0 15px;outline:none;}[/B]
[B]#menu ul.level1 li.level1-li a.level1-a {float:left;}[/B]
[B]#menu ul li:hover > ul {visibility:visible; left:0; top:25px;}[/B]
[B]#menu ul ul li:hover > ul {visibility:visible; left:100%; top:auto; margin-top:-25px;}[/B]
[B]#menu li.left:hover > ul {visibility:visible; left:auto; right:0; top:25px;}[/B]
[B]#menu li.left ul li:hover > ul {visibility:visible; left:auto; right:100%; top:auto; margin-top:-25px;}[/B]
[B]#menu a:hover ul {left:0; top:23px;}[/B]
[B]#menu li.left a:hover ul {left:auto; right:-1px; top:23px;}[/B]
[B]#menu li.left ul a {text-align:right; padding:0 15px 0 15px;}[/B]
[B]#menu a:hover a:hover ul,[/B]
[B]#menu a:hover a:hover a:hover ul {left:100%; visibility:visible;}[/B]
[B]#menu li.left a:hover a:hover ul,[/B]
[B]#menu li.left a:hover a:hover a:hover ul {left:auto; right:0; visibility:visible;}[/B]
[B]#menu a:hover ul ul,[/B]
[B]#menu a:hover a:hover ul ul {left:-9999px;}[/B]
[B]#menu li.left a:hover ul ul,[/B]
[B]#menu li.left a:hover a:hover ul ul {left:-9999px;}[/B]
[B]#menu li a.fly {font-variant: small-caps;}[/B]
[B]#menu li.left ul a.fly {font-variant: small-caps;}[/B]
[B]#menu li a:hover,[/B]
[B]#menu li a.fly:hover {background-color:#555555;}[/B]
[B]#menu li:hover > a,[/B]
[B]#menu ul li:hover > a.fly {background-color:#555555;}[/B]
[B]#menu table {position:absolute; height:0; width:0; left:0; border-collapse:collapse; margin-top:-4px;}[/B]
[B]#menu table table {position:absolute; left:99%; height:0; width:0; border-collapse:collapse; margin-top:-29px;}[/B]
[B]#menu li.left table {position:absolute; height:0; width:0; left:auto; right:0; border-collapse:collapse; margin-top:-4px;}[/B]
[B]#menu li.left table table {position:absolute; left:auto; right:100%; height:0; width:0; border-collapse:collapse; margin-top:-29px;}[/B]
[B]#menu ul, .tabs-outer {overflow:visible;}[/B]
[B]#menu li a {border: none;}[/B]
[B].main-outer {z-index:10;}/*for IE*/[/B]
[B].tabs-outer {z-index:11;}/*for IE*/[/B]
If anyone could help me out i'd appreciate it. Thanks