css实现单个按钮点击展开菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现单个按钮点击展开菜单效果代码

代码标签: css 按钮 点击 展开 菜单

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

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

<head>
    <meta charset="UTF-8">
<style>
    body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #dcdc39;
    font-family: 'Open Sans', Verdana, Geneva, Tahoma, sans-serif;
}

body, .nav, .menu {
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav {
    position: relative;
    background-color: #fff;
    padding: 20px;
    transition: 0.5s;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 8px 15px rgba(0,0,0,.2);
}

.menu {
    margin: 0;
    padding: 0;
    width: 0;
    overflow: hidden;
    transition: 0.5s;
}

.nav input:checked ~ .menu {
    width: 450px;
}

.menu li {
    list-style: none;
    margin: 0 10px;
}

.menu li a {
    text-decoration: none;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    transition: 0.5s;
}

.menu li a:hover {
    color: #161919;
}

.nav input {
    width: 40px;
    height: 40px;
    cursor: pointer;
    opacity: 0;
}

.nav span {
    position: absolute;
    left: 30px;
    width: 30px;
    height: 4px;
    .........完整代码请登录后点击上方下载按钮下载查看

网友评论0