デモ
See the Pen background image by logsuke (@design-list) on CodePen.
コード
<header class="header" id="header">
<nav id="nav" class="nav">
<a href="#" class="logo">
<svg viewBox="0 0 496 512" width="100" title="meh-rolling-eyes">
<path
d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM88 224c0-24.3 13.7-45.2 33.6-56-.7 2.6-1.6 5.2-1.6 8 0 17.7 14.3 32 32 32s32-14.3 32-32c0-2.8-.9-5.4-1.6-8 19.9 10.8 33.6 31.7 33.6 56 0 35.3-28.7 64-64 64s-64-28.7-64-64zm224 176H184c-21.2 0-21.2-32 0-32h128c21.2 0 21.2 32 0 32zm32-112c-35.3 0-64-28.7-64-64 0-24.3 13.7-45.2 33.6-56-.7 2.6-1.6 5.2-1.6 8 0 17.7 14.3 32 32 32s32-14.3 32-32c0-2.8-.9-5.4-1.6-8 19.9 10.8 33.6 31.7 33.6 56 0 35.3-28.7 64-64 64z" />
</svg>
logo
</a>
<div class="nav-menu" id="navMenu">
<ul class="nav-links">
<li><a href="#section1" class="active nav-link section1">Section1</a></li>
<li><a href="#section2" class="nav-link section2">Section2</a></li>
<li><a href="#section3" class="nav-link section3">Section3</a></li>
<li><a href="#section4" class="nav-link section4">Section4</a></li>
</ul>
</div>
<div class="nav-toggle" id="navToggle">
<i id="navIcon" class='bx bx-menu'></i>
</div>
</nav>
</header>
<main>
<section id="section1" class="section">
</section>
<section id="section2" class="section">
<img src="https://picsum.photos/id/1025/1000/1500" alt="">
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none">
<path d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z" class="shape-fill"></path>
</svg>
</section>
<section id="section3" class="section">
</section>
<section id="section4" class="section">
</section>
</main>
* {
margin: 0;
padding: 0;
box-sizing: border-box
}
:root {
--nav-height: 8rem;
--max-width: 1200px;
--container-padding: 0 4rem;
--gap: 5rem;
--bg-color: rgb(240, 240, 240);
--first-color: rgb(172, 245, 255);
--text-color: rgb(77, 77, 77);
}
/*=== Font ratio ===*/
html {
scroll-behavior: smooth;
font-size: 62.5%;
}
body {
font-size: 1.6rem;
}
ul {
list-style: none;
}
a {
text-decoration: none;
color: var(--text-color);
}
/* header */
header {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background-color: var(--bg-color);
}
.nav svg {
width: 25px;
padding: 2px;
margin-right: 5px;
}
/* nav */
.nav {
width: 100%;
max-width: var(--max-width);
height: var(--nav-height);
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 auto;
padding: 0 3rem;
}
.logo,
.nav-toggle {
color: var(--text-color);
cursor: pointer;
}
.logo {
font-weight: bold;
font-size: 2rem;
z-index: 100;
display: flex;
justify-content: center;
align-items: center;
}
.nav-toggle {
font-size: 3rem;
display: flex;
align-items: center;
z-index: 200;
}
.nav-toggle i {
display: none;
}
.nav-links {
display: flex;
align-items: center;
justify-content: center;
gap: 2rem;
}
.nav-links a {
color: var(--text-color);
position: relative;
}
.nav-links a.active::before {
content: '';
position: absolute;
bottom: -.8rem;
left: 0;
width: 100%;
height: 3px;
border-radius: 3px;
background: rgb(147, 147, 247);
}
/*スマホサイズナビゲーションバー*/
@media screen and (max-width: 768px) {
.nav-menu {
position: fixed;
top: 0;
right: -50%;
background: var(--bg-color);
box-shadow: var(--shadow);
width: 50%;
height: 100vh;
padding-top: var(--nav-height);
transition: transform .5s ease-in-out;
z-index: 120;
}
.nav-menu.toggle {
transform: translateX(-100%);
}
.nav-toggle i {
display: block;
}
.nav-links {
flex-direction: column;
}
.nav-links li {
height: var(--nav-height);
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
/*=== section ===*/
.section {
/* min-height: 100vh; */
margin: 0 auto;
position: relative;
}
#section1 {
padding-top: var(--nav-height);
position: relative;
width: 100%;
height: 100vh;
background-image: url('https://picsum.photos/id/237/1000/1500');
background-size: cover;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center;
clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
/* clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%); */
/* clip-path: circle(180vh at 50% -80vh); */
}
#section1::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg, rgba(185, 255, 157, 1) 0%, rgba(161, 225, 255, 1) 50%, rgba(240, 255, 67, 1) 100%);
opacity: .6;
}
#section2 {
position: relative;
width: 100%;
height: 100vh;
background: linear-gradient(90deg, rgba(185, 255, 157, 1) 0%, rgba(161, 225, 255, 1) 50%, rgba(240, 255, 67, 1) 100%);
}
#section2 img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: top;
transition: opacity .4s;
}
#section2 img:hover {
opacity: .6;
}
#section2 svg {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
line-height: 0;
transform: rotate(180deg);
width: 100%;
height: 120px;
}
#section2 path {
fill: #fff;
}