Simple flyout CSS menu *beta

The very simple CSS one level flyout menu (perhaps more accessible)

Nothing new in CSS menu technology, just a test ...
Live Demo:

The CSS code:

<style type="text/css">
/* =========================================================================
For any free or commercial usage please keep this credits text intact.
Author : Femi Hasani www.vision.to ,test idea and CSS code.
The original version of this stylesheet and the associated (x)html
is available at http://www.vision.to/simple-css-one-level-flyout-menu.php
A link to www.vision.to would be apperciated but not mandatory.
=============================================================================== */
#navigation ul#nav {
z-index: 5000;
width:200px;
}

#navigation ul#nav li {
list-style:none;
position: relative;
/*float: left;*/ /* commented for flyout use else dropdown*/
text-align: center;
line-height: .8em;
width:175px;
}

#navigation ul#nav li a {
display: block;
padding: 12px 0;
color: #fff;
text-decoration: none;
/* border-right: 1px solid #ccc; */
text-align: center;
background:#000;
}

#navigation ul#nav li a span {
padding: 0 15px 0 10px;
/* background: url(arrow.gif) no-repeat 100% 50%; optional */
}

#navigation ul#nav li ul {
display: block;
position: absolute;
/* hidding submenus based on: http://css-class.com/articles/ursidae/ */
left: -999em;/* this makes it more accessible than display:none; */
width: 162px;
padding: 3px 8px 3px 8px;
background:#555;
}

#navigation ul#nav li:hover ul,
#navigation ul#nav li.over ul {
display: block;
left: 135px; /* the postion near main menu */
top: 0; /* align with top of main menu */
position: absolute;
z-index: 4000;
width: 146px;
}

#navigation ul#nav li ul li {
width: 146px;
height: auto;
background: transparent;
text-indent: 0;
padding: 0;
}

#navigation ul#nav li:hover ul li a,
#navigation ul#nav li.over ul li a {
display: block;
width: 126px;/*this is to adjust if used some background image for dropdown */
background: transparent;
padding: 15px 10px;
text-decoration: none;
margin: 0;
color: #eee;
text-indent: 0;
text-align: left;
border: 0;
white-space: nowrap;
}

#navigation ul#nav li ul li a:hover {
color: #fff;
background: #62686e;
}

#navigation ul#nav li.active a,
#navigation ul#nav li a:hover,
#navigation ul#nav li:hover a,
#navigation ul#nav li.over a {
background: #555;
}
</style>

The HTML code:

<!-- start navigation -->
<div id="navigation">
<ul id="nav">
<!-- main item 1 -->
<li class="item1"><a href="#nogo" title="Demo"><span>MAIN 1</span></a>
<!-- dropdown or flyout 1 -->
<ul>
<li><a href="#nogo" title="Demo">SUB 1.1</a></li>
<li><a href="#nogo" title="Demo">SUB 1.2</a></li>
<li><a href="#nogo" title="Demo">SUB 1.3</a></li>
<li><a href="#nogo" title="Demo">SUB 1.4</a></li>
</ul>
</li>
<!-- main item 2 -->
<li class="item2"><a href="#nogo" title="Demo"><span>MAIN 2</span></a>
<!-- dropdown or flyout 2 -->
<ul>
<li><a href="#nogo" title="Demo">SUB 2.1</a></li>
<li><a href="#nogo" title="Demo">SUB 2.2</a></li>
<li><a href="#nogo" title="Demo">SUB 2.3</a></li>
<li><a href="#nogo" title="Demo">SUB 2.4</a></li>
</ul>
</li>
</ul>
</div>
<!-- end navigation -->

JavaScript Code:

<!--[if lte IE 6]>
<script type="text/javascript" >
//author: ?, I found this useful.
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;

</script>
<![endif]-->

 

 

Related Pages

Misc Links, Resources

Upperhost best web hosting

Hobby Projects

Under development:
feedpixel.com - Feeding Your Pixels :-)
Sexy URL!
TAXI CMS Booking System
WebShop, Project Manager, Support System.

Recommended

Link Partners

Web Design Forum