1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Sub Menu Doesn't Appear

Discussion in 'HTML & Website Design' started by Irun, Jun 1, 2015.

  1. #1
    Hello,

    i'm trying to make a new blog. Also i'm quite noob. I'm adding some main and sub categories to menu tab with css + html code on blogger site. Everythings are exact same position except when i try to add one more sub category's alt. It doesn't appear. Let me show my css and html code;

    /* ----- CSS Nav Menu Styling ----- */
    #cssnav {
    margin: 0px 0 0 -30px;
    padding: 0px 0px 0px 0px;
    width: 980px;  /* Set your width to fit your blog */
    font: $(tabs.font); /* Template Designer - Change Font Type, Size, Etc */
    color: $(tabs.text.color); /* Template Designer - Change Font Size */
    }
    
    #cssnav ul {
    background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;
    _background-image: none; /* Template Designer - Change Menu Background */
    height: 20px; /* Change Height of Menu */
    list-style: none;
    margin: 0px;
    padding: 0px;
    }
    
    #cssnav li {
    float: left;
    padding: 0px;
    }
    
    #cssnav li a {
    background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;
    _background-image: none; /* Template Designer - Change Menu Background */
    display: block;
    margin: 0px;
    font: $(tabs.font); /* Template Designer - Change Font Type, Size, Etc */
    text-decoration: none;
    }
    
    #cssnav > ul > li > a {
    color: $(tabs.text.color); /* Template Designer - Change Font Color */
    }
    
    #cssnav ul ul a {
    color: $(tabs.text.color); /* Template Designer - Change Color */
    }
    
    #cssnav li > a:hover, #cssnav ul li:hover {
    color: $(tabs.selected.text.color); /* Template Designer - Change Font Color on Hover */
    background-color: $(tabs.selected.background.color); /* Template Designer - Change Font Background on Hover */
    text-decoration: none;
    }
    
    #cssnav li ul {
    background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;
    _background-image: none; /* Template Designer - Change Menu Background */
    display: none;
    height: auto;
    padding: 0px;
    margin: 0px;
    position: absolute;
    width: 200px; /* Change Width Of DropDown Menu */
    z-index:9999;
    }
    
    #cssnav li:hover ul {
    display: block;
    }
    
    #cssnav li li {
    background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;
    _background-image: none; /* Template Designer - Change Background */
    display: block;
    float: none;
    margin: 0px;
    padding: 0px;
    width: 200px; /* Change Width Of DropDown Menu */
    }
    
    #cssnav li:hover li a {
    background: $(tabs.selected.background.color); /* Template Designer - Change Background of Link on Hover */
    }
    
    #cssnav li ul a {
    display: block;
    height: auto;
    margin: 0px;
    padding: 10px;
    text-align: left;
    }
    
    #cssnav li ul a:hover, #cssnav li ul li:hover > a {
    color: $(tabs.selected.text.color); /* Template Designer - Change Text Color on Hover */
    background-color: $(tabs.selected.background.color); /* Template Designer - Change Background on Hover */
    border: 0px;
    text-decoration: none;
    }
    Code (CSS):

    and my html code;

    <!-- start navmenu -->
    <ul id='cssnav'>
       
            <li><a href="#">Home</a></li>
            <li><a href="#">Tutorials</a>
                <ul>
                    <li><a href="#">Photoshop</a></li>
                    <li><a href="#">Illustrator</a></li>
                    <li><a href="#">Web Design</a>
                        <ul>
                            <li><a href="#">HTML</a></li>
                            <li><a href="#">CSS</a></li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li><a href="#">Articles</a>
                <ul>
                    <li><a href="#">Web Design</a></li>
                    <li><a href="#">User Experience</a></li>
                </ul>
            </li>
            <li><a href="#">Inspiration</a></li>
        </ul>
    <!-- end navmenu -->
    HTML:
    When i come to "Web Design" category, it doesn't show my "html" and "css" alt categories. They're not appear. What should cause of that? probably i'm totally missing something but my knowledge is so beginner about it.
     
    Irun, Jun 1, 2015 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    a LOT of problems there -- even the fixed 980px width is "how not to make a website"

    Biggest problems I'm seeing though?

    1) No relative positioning for that absolute positioning to be based on, (so that absolute is treating the upper left corner of the PAGE or the nearest relative parent as 0,0) -- the parent LI should be position:relative.

    2) Z-index is based on the positioning of the PARENT element, IF you need to depth sort the dropdowns I'd be setting relative positioning and Z-index on the entire #CSSNav element.

    3) you should probably use left:-999em instead of display:none to hide them, otherwise screen readers won't be able to read/navigate your menu.

    4) what's with the 30px negative left-margin on the UL? That seems... wonky. (though hard to say without seeing the rest of the page)

    5) You aren't saying top or left on your absolute elements, so just where are you expecting them to even show?
     
    deathshadow, Jun 1, 2015 IP