サンプルページ
HTML&CSS
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" href="style.css" type="text/css" />
<title>グローバルナビゲーション|シンプル1 左からスライドイン, スライドアウト</title>
</head>
<body>
<header>
<a href=""><img src="logo.webp" alt="サイトロゴ" class="global_navi_simple1_left1_1" /></a>
<!-- ハンバーガーボタン -->
<input type="checkbox" id="global_navi_simple1_left1_2">
<label for="global_navi_simple1_left1_2" class="global_navi_simple1_left1_3"><span></span><span></span><span></span></label>
<!-- ハンバーガーボタン ここまで -->
<!-- メニュー -->
<div class="global_navi_simple1_left1_4">
<a href=""><img src="logo.webp" alt="サイトロゴ" class="global_navi_simple1_left1_5" /></a>
<ul>
<li><a href="">リンク1</a></li>
<li><a href="">リンク2</a></li>
<li><a href="">リンク3</a></li>
<li><a href="">リンク4</a></li>
<li><a href="">リンク5</a></li>
</ul>
</div>
<!-- メニュー ここまで -->
</header>
<center>
<br>
<br>
本文<br>
<br>
テキスト<br>
<br>
テキスト
</center>
<footer></footer>
</body>
</html>
@charset "utf-8";
body{
width: 100%;
margin: 0;
padding: 0;
}
/* 標準・モバイル用 */
@media(max-width: 1023px){
.global_navi_simple1_left1_1{
display: block;
width: 7rem;
margin: 1.5rem auto 0 auto;
}
#global_navi_simple1_left1_2{
display: none;
}
#global_navi_simple1_left1_2:checked ~ .global_navi_simple1_left1_3 span:nth-of-type(1){
top: 18px;
left: 18px;
transform: translateY(6px) rotate(-45deg);
width: 30%;
}
#global_navi_simple1_left1_2:checked ~ .global_navi_simple1_left1_3 span:nth-of-type(2){
opacity: 0;
}
#global_navi_simple1_left1_2:checked ~ .global_navi_simple1_left1_3 span:nth-of-type(3){
top: 30px;
left: 18px;
transform: translateY(-6px) rotate(45deg);
width: 30%;
}
#global_navi_simple1_left1_2:checked ~ .global_navi_simple1_left1_4{
right: 0;
transition: 0.6s;
}
.global_navi_simple1_left1_3{
position: fixed;
z-index: 999;
top: 0;
right: 0;
width: 52px;
height: 52px;
cursor: pointer;
background-color: #ccc;
}
.global_navi_simple1_left1_3 span{
position: absolute;
display: inline-block;
width: 16px; /* ラインの横幅 */
transition: all .4s;
left: 18px; /*左からの距離 */
height: 2px; /* ラインの太さ */
background: #fff; /* ライン色 */
}
.global_navi_simple1_left1_3 span:nth-of-type(1){
top: 17px;
}
.global_navi_simple1_left1_3 span:nth-of-type(2){
top: 24px;
}
.global_navi_simple1_left1_3 span:nth-of-type(3){
top: 31px;
}
/* メニュー */
.global_navi_simple1_left1_4{
position: fixed;
z-index: 998;
top: 0;
right: 100%; /* 右側に余白100%を指定し、メニュー画面を画面左側に隠す */
width: 100%;
height: 100vh;
transition: right 0.6s; /* メニュー画面を閉じるとき、スライドしながら閉じる */
overflow-y: scroll;
background-color: #fff;
}
.global_navi_simple1_left1_4 ul{
list-style: none;
padding: 0;
margin: 1rem 0 0 0;
}
.global_navi_simple1_left1_4 ul li a{
display: block;
width: 80%;
text-decoration: none;
color: #333;
padding: 1rem 1rem 0.5rem 1rem;
margin: 0 auto 0 auto;
border-bottom: 1px solid #ccc;
}
.global_navi_simple1_left1_5{
display: block;
width: 7rem;
margin: 1.5rem auto 0 auto;
}
/* メニュー ここまで */
}
/* PC用 */
@media(min-width: 1024px){
body{
max-width: 1920px;
margin: 0 auto;
}
.global_navi_simple1_left1_1{
display: none;
}
#global_navi_simple1_left1_2{
display: none;
}
.global_navi_simple1_left1_4{
display: flex;
justify-content: space-between;
}
.global_navi_simple1_left1_5{
display: inline-block;
width: 10rem;
margin: 2rem 0 0 2rem;
}
.global_navi_simple1_left1_4 ul{
display: inline-block;
list-style: none;
padding: 0;
margin: 1rem 2rem 0 0;
}
.global_navi_simple1_left1_4 ul li{
display: inline-block;
}
.global_navi_simple1_left1_4 ul li a{
display: block;
width: 5rem;
text-align: center;
text-decoration: none;
color: #333;
padding: 1rem 1rem 0.5rem 1rem;
margin: 0 0.5rem 0 0.5rem;
border-bottom: 1px solid #ccc;
}
}