Hi everyone, I'm new to CSS so I really don't have a great grasp on it yet. I'm trying to make a flyout menu for product categories and this is the styling I came up with so far:
Here is the example of the HTML I'm putting together
That works great if you only want to go one level down in categories, but I want to be able to go further down than that, and if you take a look at http://www.ecommphppro.com/maincode You'll see that it expands all levels when I only want to do one at a time, I also would only like the arrow graphic to appear when there are sub-categories. CSS seems to be confusing to me, can anyone shed some light on this for me? Thanks...
Code:
#flyout { width: 175px; margin: 0; padding: 0; list-style: none; background: #c0c0c0; color: #000000; font: 12px Arial, sans-serif; } #flyout li { display: block; width: 100%; } #flyout li a { display: block; height: 100%; padding: 5px; font-weight: bold; color: #000000; text-decoration: none; } #flyout li a:hover { background: #808080; color: #FFFFFF; background-image:url(images/arrow.gif); background-repeat:no-repeat; background-position:160px 7px; } /* Position the submenu relative to the main menu */ #flyout li.sub { position: relative; background-image:url(images/arrow.gif); background-repeat:no-repeat; background-position:160px 6px; } /* Set the style of the sub menu and hide it */ #flyout li.sub ul { margin: 0; padding: 0; border: 2px solid gray; border-style: groove; width: 175px; list-style: none; font: 100% Arial, sans-serif; background: #c0c0c0; color: #000000; position: absolute; left: -1000em; } /* Show the submenu */ #flyout li.sub:hover ul { top: 0; left: 175px; }
Code:
<ul class="flyout"> <li class="sub"> <a href="index.php?scat=4">Demo Category</a> <ul> <li> <a href="index.php?scat=10">Another Demo Child</a> </li> <li> <a href="index.php?scat=5">Demo Child Category</a> <ul> <li> <a href="index.php?scat=11">Demo Grandchild</a> </li> </ul> </li> </ul> </li> </ul>
Comment