<div class="mobile">
<div class="header">
<h1 class="header__logo">Logo</h1>
</div>
<div class="contents">
<ul class="list">
<li class="card">
<div class="card__img"></div>
<div class="card__field">
<div class="card__text"></div>
<div class="card__text"></div>
<div class="card__text"></div>
</div>
</li>
<li class="card">
<div class="card__img"></div>
<div class="card__field">
<div class="card__text"></div>
<div class="card__text"></div>
<div class="card__text"></div>
</div>
</li>
<li class="card">
<div class="card__img"></div>
<div class="card__field">
<div class="card__text"></div>
<div class="card__text"></div>
<div class="card__text"></div>
</div>
</li>
</ul>
</div>
<div class="menu js-menu">
<span class="menu__line"></span>
<span class="menu__line"></span>
<span class="menu__line"></span>
</div>
<nav class="nav js-nav">
<ul class="nav__list js-nav__list">
<li class="nav__item"><a href="#" class="nav__link">link</a></li>
<li class="nav__item"><a href="#" class="nav__link">link</a></li>
<li class="nav__item"><a href="#" class="nav__link">link</a></li>
<li class="nav__item"><a href="#" class="nav__link">link</a></li>
</ul>
</nav>
</div>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
$bg-color: #eee;
$color-white: #fff;
$color-black: #222;
$color-purple-dark: #7f39fb;
$color-purple-light: #dbb2ff;
* {
box-sizing: border-box;
}
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
font-family: 'Roboto', sans-serif;
background-color: $bg-color;
display: flex;
align-items: center;
justify-content: center;
}
.mobile {
width: 320px;
height: 480px;
background-color: $color-white;
border-radius: 21px;
box-shadow: 0px 4px 50px #bbb;
position: relative;
overflow: hidden;
}
.header {
height: 50px;
width: 100%;
display: flex;
align-items: center;
padding: 0px 16px;
background-color: $color-purple-dark;
&__logo {
font-size: 22px;
color: $color-white;
letter-spacing: 0.05em;
}
}
.contents {
display: block;
padding: 16px;
height: 430px;
}
.list {
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
height: 100%;
}
.card {
width: 100%;
display: flex;
padding: 16px;
background-color: $color-purple-light;
border-radius: 8px;
&__img {
width: 100px;
height: 80px;
background-color: $color-purple-dark;
border-radius: 8px;
margin-right: 16px;
}
&__field {
display: flex;
flex: 1;
flex-direction: column;
justify-content: space-around;
}
&__text {
display: block;
height: 10px;
width: 100%;
background-color: $color-purple-dark;
border-radius: 13px;
}
}
.menu {
display: block;
position: absolute;
bottom: 16px;
right: 16px;
background-color: $color-black;
height: 50px;
width: 50px;
border-radius: 50%;
z-index: 20;
box-shadow: 0px 3px 8px #333;
cursor: pointer;
&__line {
display: block;
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 30px;
height: 4px;
background-color: $color-white;
border-radius: 13px;
transition-duration: .4s;
&:nth-child(1) {
top: 14px;
}
&:nth-child(2) {
top: 23px;
}
&:nth-child(3) {
bottom: 14px;
}
}
// hamburger menu transformation
&.active {
background-color: rgba(0, 0, 0, 0);
box-shadow: none;
}
&.active .menu__line:nth-child(1) {
transform: translate(-12px, 9px) rotate(-45deg);
}
&.active .menu__line:nth-child(2) {
transition-duration: 0s;
opacity: 0;
}
&.active .menu__line:nth-child(3) {
transform: translate(-12px, -9px) rotate(45deg);
}
}
.nav {
display: block;
position: absolute;
bottom: 16px;
right: 16px;
background-color: $color-black;
height: 50px;
width: 50px;
border-radius: 50%;
z-index: 10;
transition-duration: .4s;
&.open {
background-color: rgba(0, 0, 0, 0.9);
width: 320px;
height: 480px;
position: absolute;
right: 0px;
bottom: 0px;
border-radius: 0;
display: flex;
justify-content: center;
align-items: center;
}
&__list {
display: none;
&.show {
display: flex;
flex-direction: column;
list-style: none;
margin: 0;
padding: 0;
}
}
&__item {
display: flex;
align-items: center;
justify-content: center;
background-color: transparent;
width: 100%;
opacity: 0;
animation-name: fadein;
animation-duration: 1s;
animation-fill-mode: forwards;
&:nth-child(1) {
animation-delay: .2s;
}
&:nth-child(2) {
animation-delay: .3s;
}
&:nth-child(3) {
animation-delay: .4s;
}
&:nth-child(4) {
animation-delay: .5s;
}
&:not(:last-child) {
margin-bottom: 32px;
}
}
&__link {
font-size: 24px;
letter-spacing: 0.1em;
text-decoration: none;
color: $color-white;
}
}
@keyframes fadein {
0% {
opacity: 0;
transform: translateY(24px);
}
100% {
opacity: 1;
}
}
View Compiled
$('.js-menu').on('click', () => {
$('.js-menu').toggleClass('active');
$('.js-nav').toggleClass('open');
$('.js-nav__list').toggleClass('show');
});
This Pen doesn't use any external CSS resources.