纯css实现扁平化下拉菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:纯css实现扁平化下拉菜单效果代码

代码标签: 扁平化 下拉菜单 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

  
  
  
<style>
#menu{
    width: 100%;
    padding:10px 0 0 0;
    list-style: none;
    background: #34495e;border-left:30px solid #34495e;border-radius:3px
}

#menu li{
    float: left;
    padding:0 0 10px 0;
    position: relative;
}

#menu a{
    float: left;
    height: 25px;
    padding:0 12px 0 12px;
    color: #fff;
    text-transform: uppercase;
    font: bold 12px/25px Arial, Helvetica;
    text-decoration: none;
}

#menu li:hover > a{background:#16a085;
    color: #fff;
}

*html #menu li a:hover{ /* IE6 */
    color: #fff;
}

#menu li:hover > ul{
    display: block;
}

/* Sub-menu */
#menu ul{
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    z-index: 99999;
    background: #2c3e50;
    -moz-border-radius: 5px;
    border-radius: 5px;
}

#menu ul li{
    float: none;
    margin:0;
    padding: 0;
    display: block;
}

#menu ul li:last-child{
}

#menu ul a{
    padding: 10px;
    height: auto;
    line-height: 1;
    display: block;
    white-space: nowrap;
    float: none;
    text-transform: none;
}

*html #menu ul a{ /* IE6 */
    height: 10px;
    width: 150px;
}

*:first-child+html #menu ul a{ /* IE7 */
    height: 10px;
    width: 150px;
}

#menu ul a:hover{
        background: #16a085;
}

#menu ul li:first-child a{
    -moz-border-radius: 5px 5px 0 0;
    -webkit-border-radius: 5px 5px 0 0;
    border-radius: 5px 5px 0 0;
}

#menu ul li:first-child a:after{
    content: '';
    position: absolute;
    left: 30px;
    top: -8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #2c3e50;
}

#menu u.........完整代码请登录后点击上方下载按钮下载查看

网友评论0