0

I am using a drop down menu using pure css. I need a good responsive drop down navigation menu for the below ordinary css menu code. I need the responsive using pure css and not in javascript or jquery.

I am trying to do a responsive using pure css but i could not able to do a perfect one. Any one please help me. Thanks in advance.

ul.menu{
float:right;
}

ul.menu > li{
float:left;
list-style:none;    
}

ul.menu > li.current-menu-item a{
background: #5C5C5C;
color:#fff; 
}

ul.menu > li > a{
padding: 31px;
display:block;  
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
color:#666666;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}

ul.menu > li > a:hover{
background: #5C5C5C;
color:#fff; 
}

ul.menu > li:hover > ul.sub-menu{
display:block;
visibility:visible;
list-style:none;
opacity:1;  
top: 108px; 
}

ul.menu > li > ul.sub-menu > li > a:hover{
background:#5C5C5C;
color:#fff; 
}

ul.menu > li > ul.sub-menu{
visibility:hidden;
position: absolute;
width: 200px;
z-index: 999;
list-style:none;    
background: #f9f9f9;
border: 1px solid #e9e9e9;
border-radius: 0 0 5px 5px;
border-bottom: 3px solid #757575;
top:40px;
opacity:0;  
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;  
}

ul.menu > li > ul.sub-menu > li > a{
padding: 15px;
display:block;
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
color:#666666;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
border-bottom: 1px solid #efefef;   
}
4

1 回答 1

0
<div>
    <ul class="mymenu">
        <li><a class="dropdown" href="#">Menu 1</a>
            <ul>
                <li><a href="#">Sub-menu 1</a></li>
                <li><a href="#">Sub-menu 2</a></li>
                <li><a href="#">Sub-menu  3</a></li>
            </ul>
            </li>

    </ul>
</div>


div ul {
    -webkit-font-smoothing:antialiased;
    text-shadow:0 1px 0 #FFF;
    background: #ddd;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
div li {
    float: left;
    margin: 0;
    padding: 0;
    position: relative;
    min-width: 25%;
}
div a {
    background: #ddd;
    color: #444;
    display: block;
    font: bold 16px/50px sans-serif;
    padding: 0 25px;
    text-align: center;
    text-decoration: none;
    -webkit-transition: all .25s ease;
       -moz-transition: all .25s ease;
        -ms-transition: all .25s ease;
         -o-transition: all .25s ease;
            transition: all .25s ease;
}
div .dropdown:after {
    content: ' ▶';
}
div .dropdown:hover:after{
    content:'\25bc'
}
div li:hover a {
    background: #ccc;
}
div li ul {
    float: left;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 35px;
    visibility: hidden;
    z-index: 1;
    -webkit-transition: all .25s ease;
       -moz-transition: all .25s ease;
        -ms-transition: all .25s ease;
         -o-transition: all .25s ease;
            transition: all .25s ease;
}
div li:hover ul {
    opacity: 1;
    top: 50px;
    visibility: visible;
}
div li ul li {
    float: none;
    width: 100%;
}
div li ul a:hover {
    background: #bbb;
}

/* Clearfix */

.mymenu:after, .cf:before {
    content:"";
    display:table;
}
.mymenu:after {
    clear:both;
}
.mymenu {
    zoom:1;
}
于 2013-08-19T05:12:57.463 回答