<div class="contents">
<h1>Contents</h1>
<p>コンテンツ</p>
</div>
<div class="cp_fullscreenmenu">
<input type="checkbox" id="menuToggle" />
<label for="menuToggle" class="hamburger">
<div class="open"></div>
</label>
<div class="menu menuEffects">
<label for="menuToggle"></label>
<div class="menucont">
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div>
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
a,
a:visited,
a:hover,
a:active {
text-decoration: none;
color: inherit;
}
input {
display: none;
}
.cp_fullscreenmenu {
position: fixed;
z-index: 1;
top: 0;
right: 0;
}
/*menuコンテンツ*/
.cp_fullscreenmenu .menu {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-image: linear-gradient(to top, rgba(255,8,68,0.8) 0%, rgba(255,177,153,0.7) 100%);
}
.cp_fullscreenmenu .menu label {
position: absolute;
top: 20px;
right: 20px;
width: 30px;
height: 30px;
cursor: pointer;
background-size: 100%;
}
.cp_fullscreenmenu .menu .menucont {
font-size: 54px;
position: relative;
top: 50%;
margin-top: -170px;
padding-bottom: 20px;
text-align: center;
}
.cp_fullscreenmenu .menu ul {
margin: 0 auto;
padding: 0;
list-style: none;
}
.cp_fullscreenmenu .menu ul li,
.cp_fullscreenmenu .menu ul li a {
transition: all 0.3s ease;
}
.cp_fullscreenmenu .menu ul li a {
display: block;
padding: 10px 0;
color: #ffffff;
}
.cp_fullscreenmenu .menu ul li a:hover {
color: #ff0844;
}
.cp_fullscreenmenu .menu ul li:hover {
background: #ffffff;
}
/*クリックしたらメニューが開閉の動作*/
.cp_fullscreenmenu .menuEffects {
visibility: hidden;
transition: opacity 0.5s, visibility 0.5s;
opacity: 0;
}
.cp_fullscreenmenu .menuEffects ul {
transition: all 0.5s;
transform: translateY(0%);
}
.cp_fullscreenmenu #menuToggle:checked ~ .menuEffects {
visibility: visible;
transition: opacity 0.5s;
opacity: 1;
}
.cp_fullscreenmenu #menuToggle:checked ~ .menuEffects ul {
opacity: 1;
}
.cp_fullscreenmenu #menuToggle:checked ~ .hamburger .open {
background-color: transparent;
}
.cp_fullscreenmenu #menuToggle:checked ~ .hamburger .open:before {
position: absolute;
z-index: 1;
top: 0;
right: 0;
content: '';
transform: rotate(45deg);
background-color: #ffffff;
}
.cp_fullscreenmenu #menuToggle:checked ~ .hamburger .open:after {
position: relative;
z-index: 1;
top: 0;
right: 0;
content: '';
transform: rotate(-45deg);
background-color: #ffffff;
}
.cp_fullscreenmenu #menuToggle:not(:checked) ~ .menuEffects ul {
transform: translateY(-30%);
}
/*ハンバーガー*/
.cp_fullscreenmenu .hamburger {
position: relative;
top: 0;
right: 0;
display: block;
width: 50px;
height: 50px;
padding: 15px;
cursor: pointer;
}
.cp_fullscreenmenu .hamburger:hover .open:before {
top: -9px;
}
.cp_fullscreenmenu .hamburger:hover .open:after {
top: 5px;
}
.cp_fullscreenmenu .open,
.cp_fullscreenmenu .open:before,
.cp_fullscreenmenu .open:after {
position: relative;
display: block;
width: 24px;
height: 4px;
border-radius: 2px;
background-color: #ff0844;
transition: all 0.3s ease;
}
.cp_fullscreenmenu .open {
top: 8px;
cursor: pointer;
}
.cp_fullscreenmenu .open:before {
top: -8px;
content: '';
transform: rotate(0deg);
}
.cp_fullscreenmenu .open:after {
top: 4px;
content: '';
}