A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: CSS Menu: Horizontal Submenu Items

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    12

    CSS Menu: Horizontal Submenu Items

    Hi, I've been struggling for 2 hours now, trying to get my submenu to list Horizontally instead of vertically.

    here is an example of what I'm trying to go for:
    http://www.duoh.com/csstutorials/2levelmenu/index.html

    How can I get my submenu items to display horizontally like that menu does?

    thanks for reading!

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Well here's a quick and dirty version:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    	UL {list-style: none; margin: 0; padding: 0}
    	LI {position: relative;	display: block;	float: left; padding: 1px 5px; background: #666; color: #fff;}
    	LI UL {position: absolute;	top: 1.5em; left: 0; width: 500px;}
    	LI LI {background: #999}
    </style>
    </head>
    <body>
    <ul>
      <li>Item 1 |</li>
      <li>Item 2 |</li>
      <li>Item 3 |
        <ul>
          <li>Subitem 1 |</li>
          <li>Subitem 2</li>
        </ul>
      </li>
      <li>Item 4 |</li>
      <li>Item 5</li>
    </ul>
    </body>
    </html>

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    Okay, great! Got it. Thanks a ton!

  4. #4
    Follower squidlips's Avatar
    Join Date
    Oct 2001
    Location
    Rockhampton, Queesland, Australia
    Posts
    664
    Having a similar sort of problem trying to apply this to my image rollover drop down navigation...

    I changed rdoyle720's script so that it had my images sitting well in it...
    Code:
    <style type="text/css">
    	UL {list-style: none; margin: 0; padding: 0}
    	LI {position: relative;	display: block;	float: left; padding: 0px;}
    	LI UL {position: absolute;	top: 1.5em; left: 0; width: 220px;}
    </style>

    however when I placed...
    Code:
    <ul>
      <li><a href="index.html"><img src="images/linkportfolio.jpg" alt="" oversrc="images/linkportfolioover.jpg"/></a>
        <ul>
          <li><a href="index.html"><img src="images/linkimage.jpg" oversrc="images/linkimageover.jpg" /></a></li><li><a href="index.html"><img src="images/linkillustration.jpg" oversrc="images/linkillustrationover.jpg" /></a></li><li><a href="index.html"><img src="images/linkweb.jpg" oversrc="images/linkwebover.jpg" /></a></li>
        </ul>
      </li>
    </ul>
    in place of where i used to just have...
    Code:
    <a href="index.html"><img src="images/linkportfolio.jpg" alt="" oversrc="images/linkportfolioover.jpg"/>
    it is moving the whole list to a new line in my div.

    This is what it looks like when placed in the div below my navigation.



    QUESTIONS:
    1. How do I make the 2nd tier images appear on rollover, rather than just being always visible?

    2. How can I make the "linkportfolioover.jpg" image stay when the mouse is over the drop downs?

    2. How can I make the drop downs 'float', appearing under the same relative position as the proper placed instace of "linkportfolio.jpg" rather than moving it all onto a new line?

    Any help would be really truly appreciated.
    subgenius.com

  5. #5
    Follower squidlips's Avatar
    Join Date
    Oct 2001
    Location
    Rockhampton, Queesland, Australia
    Posts
    664
    Below is what I'm using at the moment, I changed a suckerfish example a bit, and tried placing the drop down images in one list to try and get them to appear horizontally but they want to stay vertical, the one problem I think I'm having at the moment. The code is probably a bit ugly as well. :P

    AUD$10 to whoever helps helps me out. It may also be worth noting that I want the dropdowns to not push around any other content, so absolutely positioned I guess?

    Code:
    <html>
    <head>
    <title>Portfolio</title>
    
    <style type="text/css">
    
    #nav, #nav ul { /* all lists */
    padding: 0;
    margin: 0;
    list-style: none;
    line-height: 0;
    }
    
    #nav a {
    display: block;
    width: 10em;
    }
    
    #nav li { /* all list items */
    float: left;
    width: 77px; /* width needed or else Opera goes nuts */
    }
    
    #nav li ul { /* second-level lists */
    position: absolute;
    width: 220px;
    left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */
    }
    
    #nav li:hover ul, #nav li.sfhover ul { /* lists nested under hovered list items */
    left: auto;
    }
    
    #content {
    clear: left;
    color: #ccc;
    }
    
    </style>
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    
    sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
    this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
    }
    }
    
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    
    //--><!]]></script>
    
    </head>
    
    <body>
    
    <ul id="nav">
    
    <li><img src="CVIC/ADD/images/linkportfolio.jpg" alt="" width="77" height="24" />
    <ul>
    <li><img src="CVIC/ADD/images/linkimage.jpg" alt="" width="54" height="22" /><img src="CVIC/ADD/images/linkillustration.jpg" alt="" width="120" height="22" /><img src="CVIC/ADD/images/linkweb.jpg" alt="" width="46" height="22" /></li>
    
    </ul>
    </li>
    
    </ul>
    
    </body>
    
    </html>
    subgenius.com

  6. #6
    Follower squidlips's Avatar
    Join Date
    Oct 2001
    Location
    Rockhampton, Queesland, Australia
    Posts
    664
    http://www.2shared.com/file/6160494/dd82fb94/site.html

    A nice fellow over at Whirlpool helped me get this far, but I can't figure out how to get it positioned properly. The $10 is already gone and I'm a broke uni student, but you will get my eternal gratitude and a photo of me doing a handstand!
    subgenius.com

  7. #7
    Follower squidlips's Avatar
    Join Date
    Oct 2001
    Location
    Rockhampton, Queesland, Australia
    Posts
    664
    $10 back on the table! I'm dying here guys.
    subgenius.com

  8. #8
    Follower squidlips's Avatar
    Join Date
    Oct 2001
    Location
    Rockhampton, Queesland, Australia
    Posts
    664
    After all that, I just put it in a table and it works perfect. I might write a tutorial up if anyone is interested, seems like quite a powerful/flexible navigation.
    subgenius.com

  9. #9
    Junior Member
    Join Date
    Nov 2015
    Posts
    1
    شركة مكافحة النمل الابيض بالدمام
    شركة تنظيف بالدمام
    شركة تنظيف فلل بالدمام
    شركة تنظيف شقق بالدمام
    شركة تنظيف موكيت بالدمام
    شركة تنظيف مجالس بالدمام
    شركة تنظيف خزانات بالدمام
    شركة عزل اسطح بالدمام
    شركة كشف تسربات المياه بالدمام
    شركة تسليك مجارى بالدمام
    شركة تنظيف بيارات بالدمام
    شركة رش مبيدات بالدمام
    شركة نقل اثاث بالدمام
    شركة تخزين اثاث بالدمام
    شركة تنظيف منازل بالدمام
    شركة مكافحة حشرات بالدمام
    شركة تنظيف كنب بالمدينة المنورة
    شركة تنظيف بالمدينة المنورة
    شركة تنظيف فلل بالمدينة المنورة
    شركة تنظيف شقق بالمدينة المنورة
    شركة تنظيف موكيت بالمدينة المنورة
    شركة تنظيف مجالس بالمدينة المنورة
    غسيل خزانات بالمدينة المنورة
    شركة عزل اسطح بالمدينة المنورة
    شركة كشف تسربات المياه بالمدينة المنورة
    شركة تسليك مجارى بالمدينة المنورة
    شركة تنظيف بيارات بالمدينة المنورة
    شركة رش مبيدات بالمدينة المنورة
    نقل عفش بالمدينة المنورة
    شركة تخزين اثاث بالمدينة المنورة
    شركة تنظيف منازل بالمدينة المنورة
    مكافحة حشرات بالمدينة المنورة
    شركة تنظيف بالبخار بجدة
    شركة تنظيف بجدة
    شركة تنظيف فلل بجدة
    شركة تنظيف شقق بجدة
    شركة تنظيف موكيت بجدة
    شركة تنظيف مجالس بجدة
    شركة تنظيف خزانات بجدة
    شركة عزل اسطح بجدة
    شركة كشف تسربات المياه بجدة
    شركة تسليك مجارى بجدة
    شركة تنظيف بيارات بجدة
    شركة رش مبيدات بجدة
    شركة نقل اثاث بجدة
    شركة تخزين اثاث بجدة
    شركة تنظيف منازل بجدة
    شركة مكافحة حشرات بجدة
    شركة تنظيف مسابح بالرياض
    شركة تنظيف بالرياض
    شركة تنظيف فلل بالرياض
    شركة تنظيف شقق بالرياض
    شركة تنظيف موكيت بالرياض
    شركة تنظيف مجالس بالرياض
    شركة تنظيف خزانات بالرياض
    شركة عزل اسطح بالرياض
    شركة كشف تسربات المياه بالرياض
    شركة تسليك مجارى بالرياض
    شركة تنظيف بيارات بالرياض
    شركة رش مبيدات بالرياض
    شركة نقل اثاث بالرياض
    شركة تخزين اثاث بالرياض
    شركة تنظيف منازل بالرياض

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center