CSSのみでハンバーガーメニューを実装。参考元より右側だけで開くように変更しました。

<!DOCTYPE html>
<html lang=”ja”>
<head>
<link rel=”stylesheet” href=”css/hamburger.css” type=”text/css” />
<!–
https://www.asobou.co.jp/blog/web/css-menu 参考元
–>
</head>
<body>
<header>

<div class=”hamburger-menu”>
<input type=”checkbox” id=”menu-btn-check”>
<label for=”menu-btn-check” class=”menu-btn”><span></span></label>
<!–ここからメニュー–>
<div class=”menu-content”>
<ul>
<li><a href=”menu01″>メニュー1</a></li>
<li><a href=”menu01″>メニュー2</a></li>
<li><a href=”menu01″>メニュー3</a></li>
<li><a href=”menu01″>メニュー4</a></li>
</ul>
</div>
<!–ここまでメニュー–>
</div>

</header>
</body>
</html>

 

 

[css/hamburger.css]

.menu-btn {
position: fixed;
top: 10px;
right: 10px;
display: flex;
height: 60px;
width: 60px;
justify-content: center;
align-items: center;
z-index: 90;
// background-color: #3584bb;
background-color: #294197;
}
.menu-btn span,
.menu-btn span:before,
.menu-btn span:after {
content: ”;
display: block;
height: 3px;
width: 25px;
border-radius: 3px;
background-color: #ffffff;
position: absolute;
}
.menu-btn span:before {
bottom: 8px;
}
.menu-btn span:after {
top: 8px;
}

#menu-btn-check:checked ~ .menu-btn span {
background-color: rgba(255, 255, 255, 0);/*メニューオープン時は真ん中の線を透明にする*/
}
#menu-btn-check:checked ~ .menu-btn span::before {
bottom: 0;
transform: rotate(45deg);
}
#menu-btn-check:checked ~ .menu-btn span::after {
top: 0;
transform: rotate(-45deg);
}

#menu-btn-check {
display: none;
}

#menu-btn-check:checked ~ .menu-content {
// left: 0;/*メニューを画面内へ*/
left: 80%;/*menu-contentを20%にして、右側だけ*/
}

.menu-content {
// width: 100%;
width: 20%;
height: 100%;
position: fixed;
top: 0;
left: 100%;/*leftの値を変更してメニューを画面外へ*/
z-index: 80;
// background-color: #3584bb;
background-color: #294197;
transition: all 0.5s;/*アニメーション設定*/
}
.menu-content ul {
padding: 70px 10px 0;
}
.menu-content ul li {
border-bottom: solid 1px #ffffff;
list-style: none;
}
.menu-content ul li a {
display: block;
width: 100%;
font-size: 15px;
box-sizing: border-box;
color:#ffffff;
text-decoration: none;
padding: 9px 15px 10px 0;
position: relative;
}
.menu-content ul li a::before {
content: “”;
width: 7px;
height: 7px;
border-top: solid 2px #ffffff;
border-right: solid 2px #ffffff;
transform: rotate(45deg);
position: absolute;
right: 11px;
top: 16px;
}

ハンバーガーメニュー