Grow your CSS skills. Land your dream job.

New CSS3 Menu

  • # March 27, 2013 at 10:20 am

    Hello I have a menu the use for default but cant seem to change it to way I want code won’t pick it up here is basic one in css

    #menu {
    background: #585858;
    border-bottom: 1px solid #000000;
    height: 37px;
    margin-bottom: 15px;
    -webkit-border-radius: 5px 5px 5px 5px;
    -moz-border-radius: 5px 5px 5px 5px;
    -khtml-border-radius: 5px 5px 5px 5px;
    border-radius: 5px 5px 5px 5px;
    -webkit-box-shadow: 0px 2px 2px #DDDDDD;
    -moz-box-shadow: 0px 2px 2px #DDDDDD;
    box-shadow: 0px 2px 2px #DDDDDD;
    padding: 0px 5px;
    }
    #menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    }
    #menu > ul > li {
    position: relative;
    float: left;
    z-index: 20;
    padding: 6px 5px 5px 0px;
    }
    #menu > ul > li:hover {
    }
    #menu > ul > li > a {
    font-size: 13px;
    color: #FFF;
    line-height: 14px;
    text-decoration: none;
    display: block;
    padding: 6px 10px 6px 10px;
    margin-bottom: 5px;
    z-index: 6;
    position: relative;
    }
    #menu > ul > li:hover > a {
    background: #000000;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -khtml-border-radius: 5px;
    border-radius: 5px;
    }
    #menu > ul > li > div {
    display: none;
    background: #FFFFFF;
    position: absolute;
    z-index: 5;
    padding: 5px;
    border: 1px solid #000000;
    -webkit-border-radius: 0px 0px 5px 5px;
    -moz-border-radius: 0px 0px 5px 5px;
    -khtml-border-radius: 0px 0px 5px 5px;
    border-radius: 0px 0px 5px 5px;
    background: url(‘../image/menu.png’);
    }
    #menu > ul > li:hover > div {
    display: table;
    }
    #menu > ul > li > div > ul {
    display: table-cell;
    }
    #menu > ul > li ul + ul {
    padding-left: 20px;
    }
    #menu > ul > li ul > li > a {
    text-decoration: none;
    padding: 4px;
    color: #FFFFFF;
    display: block;
    white-space: nowrap;
    min-width: 120px;
    }
    #menu > ul > li ul > li > a:hover {
    background: #000000;
    }
    #menu > ul > li > div > ul > li > a {
    color: #FFFFFF;
    }

    Here is the one I would like to implement tried do do some changes but needs to be same layout as old menu

    #menu,#menu ul {
    list-style: none outside none;
    margin: 0;
    padding: 0;
    }
    #menu {
    background: url(‘../menuimages/menu_bg.png’) no-repeat scroll 0 0 transparent;
    clear: both;
    font-size: 12px;
    height: 58px;
    padding: 0 0 0 9px;
    position: relative;
    width: 980px;
    }
    #menu ul {
    background-color: #222;
    border:1px solid #222;
    border-radius: 0 5px 5px 5px;
    border-width: 0 1px 1px;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
    left: -9999px;
    overflow: hidden;
    position: absolute;
    top: -9999px;
    z-index: 20;

    -moz-transform: scaleY(0);
    -ms-transform: scaleY(0);
    -o-transform: scaleY(0);
    -webkit-transform: scaleY(0);
    transform: scaleY(0);

    -moz-transform-origin: 0 0;
    -ms-transform-origin: 0 0;
    -o-transform-origin: 0 0;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;

    -moz-transition: -moz-transform 0.1s linear;
    -ms-transition: -ms-transform 0.1s linear;
    -o-transition: -o-transform 0.1s linear;
    -webkit-transition: -webkit-transform 0.1s linear;
    transition: transform 0.1s linear;
    }
    #menu li {
    background: url(‘../menuimages/menu_line.png’) no-repeat scroll right 5px transparent;
    float: left;
    position: relative;
    }
    #menu > ul > li > a {
    color: #FFFFFF;
    display: block;
    float: left;
    font-weight: normal;
    height: 30px;
    padding: 23px 20px 0;
    position: relative;
    text-decoration: none;
    text-shadow: 1px 1px 1px #000000;
    }
    #menu ul > li:hover > a {
    color: #00B4FF;
    }
    #menu li:hover, #menu a:focus, #menu a:hover, #menu a:active {
    background: none repeat scroll 0 0 #121212;
    outline: 0 none;
    }
    #menu li:hover ul.subs {
    left: 0;
    top: 53px;
    width: 180px;

    -moz-transform: scaleY(1);
    -ms-transform: scaleY(1);
    -o-transform: scaleY(1);
    -webkit-transform: scaleY(1);
    transform: scaleY(1);
    }
    #menu ul li {
    background: none;
    width: 100%;
    }
    #menu ul li a {
    float: none;
    }
    #menu ul li:hover > a {
    background-color: #121212;
    color: #00B4FF;
    }
    #lavalamp {
    background: url(‘../menuimages/lavalamp.png’) no-repeat scroll 0 0 transparent;
    height: 16px;
    left: 13px;
    position: absolute;
    top: 0px;
    width: 64px;

    -moz-transition: all 300ms ease;
    -ms-transition: all 300ms ease;
    -o-transition: all 300ms ease;
    -webkit-transition: all 300ms ease;
    transition: all 300ms ease;
    }
    #lavalamp:hover {
    -moz-transition-duration: 3000s;
    -ms-transition-duration: 3000s;
    -o-transition-duration: 3000s;
    -webkit-transition-duration: 3000s;
    transition-duration: 3000s;
    }
    #nav li:nth-child(1):hover ~ #lavalamp {
    left: 13px;
    }
    #nav li:nth-child(2):hover ~ #lavalamp {
    left: 90px;
    }
    #nav li:nth-child(3):hover ~ #lavalamp {
    left: 170px;
    }
    #nav li:nth-child(4):hover ~ #lavalamp {
    left: 250px;
    }
    #nav li:nth-child(5):hover ~ #lavalamp {
    left: 330px;
    }
    #nav li:nth-child(6):hover ~ #lavalamp {
    left: 410px;
    }
    #nav li:nth-child(7):hover ~ #lavalamp {
    left: 490px;
    }
    #nav li:nth-child(8):hover ~ #lavalamp {
    left: 565px;
    }

    # March 27, 2013 at 10:24 am

    You haven’t explained what you want… go to http://codepen.io and create a working version of it

    # March 27, 2013 at 11:07 am

    And the use of `nth-child` that much worries me too.

    # March 27, 2013 at 4:16 pm

    > transition-duration: 3000s;

    And a transition that lasts almost an hour…

    # March 27, 2013 at 4:41 pm

    I’d actually like to see a use case for long CSS transitions (e.g. transition: all 300s ease-in).

    Edit: But then again, that’s not quite how it works.

    # March 27, 2013 at 7:26 pm

    To All will try and not use the nth child can’t use code pen because work is in php/html trying to customize my open cart theme

    # March 27, 2013 at 7:37 pm

    @mwbcomputers, well, you could copy your relevant html _output_ into a pen.. It’s much easier to help when there’s something to look at..a live link would help as well.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".