Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Display sub category drop down inline with category

    I've been trying to get a drop down menu to display the drop down box to the right of the text (The length of each word varies so I can't just pad it left). It can be seen here in the category section of the sidebar (edit: removed url) at the moment it drops down and obscures the menu item below it.

    This is the css it is using

    Code:
    /* Dropdown Category Navigation */
    .sf-menu, .sf-menu * {
    margin:0;
    padding:0;
    list-style:none;
    font-family: Verdana, Verdana, Geneva, sans-serif;
    }
    
    .sf-menu {line-height:2.5em;background:transparent;}
    .sf-menu ul {position:absolute;width:10em; /* left offset of submenus need to match (see below) */}
    .sf-menu ul li {width:100%;}
    .sf-menu li:hover {visibility:inherit;/* fixes IE7 'sticky bug' */}
    .sf-menu li {/* position:relative; */}
    .sf-menu a {line-height:2.5em;display:block;position:relative;color:#666;}
    
    .sf-menu li:hover ul,.sf-menu li.sfHover ul {
    border: solid 1px #D9D9D9;
    padding: 0 25px 0 5px;
    background: #F2F2F2;
    top:auto;
    z-index:150;
    display: inline;
    }
    
    ul.sf-menu li:hover li ul,ul.sf-menu li.sfHover li ul {top:-999em;}
    ul.sf-menu li li:hover ul,ul.sf-menu li li.sfHover ul {left:20em; /* match ul width */top:0;}
    ul.sf-menu li li:hover li ul,ul.sf-menu li li.sfHover li ul {top:-999em;}
    ul.sf-menu li li li:hover ul,ul.sf-menu li li li.sfHover ul {left:20em; /* match ul width */top:0;}
    
    .sf-menu {
    width:100%;
    }
    
    .sf-menu a {
    text-decoration: none;
    color: #0F364C;
    } 
    
    .sf-menu li {background:transparent;color:#666; }
    .sf-menu li li {background: #F2F2F2;}
    .sf-menu li li li {background:#fff;}
    
    .sf-menu a:hover, .sf-menu a:active {
    color: #06202F;
    }
    Thanks for any help
    Last edited by jondouglas; 01-02-2010 at 06:16 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts
    replace these two style classes in your css

    Code:
    .sf-menu {line-height:2.5em;background:transparent; position:relative}
    .sf-menu ul {position:absolute;width:10em; left:120px; margin-top:-20px; /* left offset of submenus need to match (see below) */}
    vineet

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I've been trying to get a drop down menu to display the drop down box to the right of the text (The length of each word varies so I can't just pad it left)
    Try
    Code:
    .sf-menu li {/*style.css (line 659)*/
    clear:left;
    float:left;
    position:relative;
    }
    .sf-menu ul {
    left:100%;
    position:absolute;
    top:1em;
    width:10em;
    }
    .sf-menu li:hover ul, .sf-menu li.sfHover ul {
    background:#F2F2F2 none repeat scroll 0;
    border:1px solid #D9D9D9;
    display:inline;
    padding:0 25px 0 5px;
    z-index:150;
    }
    h2 {/*reset.css (line 74)*/
    clear:left;
    font-size:182%;
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    New Coder
    Join Date
    Jun 2009
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi, Thanks for trying , unfortunately the code you both offered didn't quite work.

    I'll keep on messing with it

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #6
    New Coder
    Join Date
    Jun 2009
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi Excavator thanks for the help. The problem with that is that it pushes the drop down a set amount to the right. I want to make it appear at the end of each menu item. Each menu item is a variable length.

  • #7
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I found a really good drop menu you can piggy back off of that has a sub menu option with their CSS.

    Hopefully this is what you might be talking about:

    http://aplus.rs/adxmenu/examples/htb/


    Here is also a couple other CSS drop menu ideas and options:

    http://www.instantshift.com/2009/01/...tons-tutorial/


    Hope this helps you! =D

  • #8
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by jondouglas View Post
    Hi Excavator thanks for the help. The problem with that is that it pushes the drop down a set amount to the right. I want to make it appear at the end of each menu item. Each menu item is a variable length.
    I see.
    Absolute Positioning the dropped ul not going to be able to do that unless you give each one it's own id and it's own left offset.

    Messing around with floating it and stumbled across a new behavior...
    Have a look at what these changes do -
    Code:
    /* Dropdown Category Navigation */
    .sf-menu, .sf-menu * {
    margin:0;
    padding:0;
    list-style:none;
    font-family: Verdana, Verdana, Geneva, sans-serif;
    }
    
    .sf-menu {line-height:2.5em;background:transparent;}
    .sf-menu ul {
    position:relative;
    width:10em; /* left offset of submenus need to match (see below) */
    }
    .sf-menu ul li {width:100%;}
    .sf-menu li:hover {visibility:inherit;/* fixes IE7 'sticky bug' */}
    .sf-menu li {/* position:relative; */}
    .sf-menu a {line-height:2.5em;display:block;position:relative;color:#666;}
    
    .sf-menu li:hover ul,.sf-menu li.sfHover ul {
    border: solid 1px #D9D9D9;
    padding: 0 25px 0 5px;
    background: #F2F2F2;
    top:auto;
    z-index:150;
    display: inline;
    }
    
    ul.sf-menu li:hover li ul,ul.sf-menu li.sfHover li ul {top:-999em;}
    ul.sf-menu li li:hover ul,ul.sf-menu li li.sfHover ul {
    float: left;
    }
    ul.sf-menu li li:hover li ul,ul.sf-menu li li.sfHover li ul {top:-999em;}
    ul.sf-menu li li li:hover ul,ul.sf-menu li li li.sfHover ul {left:20em; /* match ul width */top:0;}
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    jondouglas (01-02-2010)

  • #9
    New Coder
    Join Date
    Jun 2009
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks Excavator, I think I'll do it like that I quite like it.


  •  

    Posting Permissions

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