<header class="header">
<div class="header__layout">
<h1 class="header__logo">
<a href="#">ここにロゴ</a>
</h1>
<nav class="header__nav">
<ul class="header__menus">
<li class="header__menu">
<a href="#">メニュー</a>
</li>
<li class="header__menu">
<a href="#">メニュー</a>
</li>
<li class="header__menu">
<a href="#">メニュー</a>
</li>
<li class="header__menu">
<a href="#">メニュー</a>
</li>
</ul>
</nav>
<!-- ハンバーガーメニューで使用するアイコン -->
<div class="hamburger">
<div class="hamburger__icon">
<div class="hamburger__bar"></div>
<div class="hamburger__bar"></div>
<div class="hamburger__bar"></div>
</div>
</div>
</div>
</header>
/* リセットCSS */
a {
color: inherit;
text-decoration: none;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
/* ヘッダーで使用 */
.header {
position: fixed;
z-index: 10;
top: 0;
left: 0;
width: 100%;
height: 100px;
background-color: #5CC0EF;
}
.header__layout {
display: flex;
justify-content: space-between;
align-items: center;
height: inherit;
margin: 0 auto;
padding: 0 20px;
}
.header__logo {
position: relative;
z-index: 12;
}
.header__logo a {
font-size: 24px;
color: #fff;
}
.header__nav {
height: inherit;
}
@media screen and (max-width: 767px) {
.header__nav {
display: none;
}
}
.header__menus {
display: flex;
justify-content: center;
align-items: center;
gap: 40px;
height: inherit;
}
.header__menu {
height: inherit;
}
.header__menu a {
display: flex;
align-items: center;
justify-content: center;
height: inherit;
font-size: 18px;
color: #fff;
transition: all 0.3s;
}
.header__menu a:hover {
color: #ffe100;
}
/* ハンバーガーメニュー関連 */
.hamburger {
display: none;
}
@media screen and (max-width: 767px) {
.hamburger {
display: block;
}
}
.hamburger__icon {
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 40px;
height: 32px;
}
.hamburger__icon:hover .hamburger__bar {
background-color: #ffe100;
}
.hamburger__icon .hamburger__bar {
background-color: #fff;
border-radius: 2px;
width: 100%;
height: 3px;
transition: all 0.3s;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.