index.html
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Furniture-store</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/hamburgers.css"> <link rel="apple-touch-icon" href="touch-icon.png"> </head> <body> <header> <h1>Furniture-store</h1> <p class="hamburger hamburger--3dx" id="ham-btn"> <span class="hamburger-box"> <span class="hamburger-inner"></span> </span> </p> </header> <nav id="g-nav"> <ul> <li><a href="#">Brands</a></li> <li><a href="#">Products</a></li> <li><a href="#">Stores</a></li> <li><a href="#">Catalogs</a></li> <li><a href="#">Styling tips</a></li> <li><a href="#">Partners & Press</a></li> </ul> </nav> <nav id="g-nav-sp"> <ul> <li><a href="#">Brands</a></li> <li><a href="#">Products</a></li> <li><a href="#">Stores</a></li> <li><a href="#">Catalogs</a></li> <li><a href="#">Styling tips</a></li> <li><a href="#">Partners & Press</a></li> </ul> </nav> <div class="container"> <div class="content-wrapper"> <div class="content"> <div class="photo-box"> <img src="img/main-01.jpg" alt=""> </div> <div class="txt-box"> <h2>Lorem, ipsum dolor.</h2> <p class="txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis numquam neque earum tempora sequi.</p> <p class="btn"><a href="#">view more</a></p> </div> </div><!-- /.content --> <div class="content"> <div class="photo-box"> <img src="img/main-02.jpg" alt=""> </div> <div class="txt-box"> <h2>Lorem, ipsum dolor.</h2> <p class="txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis numquam neque earum tempora sequi.</p> <p class="btn"><a href="#">view more</a></p> </div> </div><!-- /.content --> <div class="content"> <div class="photo-box"> <img src="img/main-03.jpg" alt=""> </div> <div class="txt-box"> <h2>Lorem, ipsum dolor.</h2> <p class="txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis numquam neque earum tempora sequi.</p> <p class="btn"><a href="#">view more</a></p> </div> </div><!-- /.content --> </div><!-- /.content-wrapper --> <div class="col-1"> <h2>Lorem, ipsum dolor sit amet<br>consectetur adipisicing elit.</h2> <p class="txt">Lorem, ipsum dolor sit amet consectetur adipisicing elit.<br>Quia dolore ad beatae fuga asperiores ab, quas aut atque nesciunt delectus mollitia suscipit<br>tempore provident perspiciatis et, soluta dolor laboriosam sint!</p> <p class="btn"><a href="#">view more</a></p> </div><!-- /.col-1 --> <div class="col-3-wrapper"> <div class="col-3-box"> <div class="col-3-img"> <img src="img/col-3-1.jpg" alt=""> </div> <div class="col-3-txt"> <h2>Lorem, ipsum dolor.</h2> <p class="icon"><img src="img/icon-1.svg" alt=""></p> <p class="btn"><a href="#">view more</a></p> </div><!-- /.col-3-txt --> </div><!-- /.col-3-box --> <div class="col-3-box"> <div class="col-3-img"> <img src="img/col-3-2.jpg" alt=""> </div> <div class="col-3-txt"> <h2>Lorem, ipsum dolor.</h2> <p class="icon"><img src="img/icon-2.svg" alt=""></p> <p class="btn"><a href="#">view more</a></p> </div><!-- /.col-3-txt --> </div><!-- /.col-3-box --> <div class="col-3-box"> <div class="col-3-img"> <img src="img/col-3-3.jpg" alt=""> </div> <div class="col-3-txt"> <h2>Lorem, ipsum dolor.</h2> <p class="icon"><img src="img/icon-3.svg" alt=""></p> <p class="btn"><a href="#">view more</a></p> </div><!-- /.col-3-txt --> </div><!-- /.col-3-box --> </div><!-- /.col-3-wrapper --> <footer> <p><small>© <span id="this-year"></span> Furniture-store</small></p> </footer> </div><!-- /.container --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <script> $(function(){ //ハンバーガーメニュー //#ham-btnをon.clickしたら $('#ham-btn').on('click',function(){ $(this).toggleClass('is-active'); $('#g-nav-sp').slideToggle(200); }); //西暦を取得 var today = new Date().getFullYear(); console.log(today); //todayが2023以上だったら if(today > 2022){ $('#this-year').text('2022 - '+today); }else{ $('#this-year').text(today); } }); </script> </body> </html>
style.css
@charset "utf-8"; /* カスタムプロパティ */ :root{ --color_1:#d2e8ed; --color_2:#ede0d2; --color_3:#edecd2; --color_4:#edd2df; } *{ margin: 0; padding: 0; box-sizing: border-box; } ul{ list-style: none; } a{ text-decoration: none; } img{ vertical-align: bottom; } /* PCレイアウト */ header{ width: 100%; height: 100px; background-color: var(--color_1); } h1{ text-align: center; line-height: 100px; font-family: 'Pacifico', cursive; } #g-nav{ width: 100%; height: 50px; background-color: var(--color_2); } #g-nav>ul{ max-width: 960px; height: 50px; display: flex; margin: 0 auto; justify-content: space-between; align-items: center; } #g-nav a{ color: #222; padding: 10px 20px; } #g-nav a:hover{ text-decoration: underline 4px #e72a6c; text-underline-offset: 4px; } .container{ padding: 0 10px 10px; } /* content部分 */ .content{ display: flex; justify-content: space-between; margin-bottom: 10px; } .content:nth-of-type(2){ flex-direction: row-reverse; } .photo-box{ width: calc((100% - 10px) / 3 * 2); height: 500px; } .photo-box>img{ object-fit: cover; width: 100%; height: 100%; } .txt-box{ width: calc((100% - 10px) / 3); background-color: var(--color_3); padding:60px 40px; } .content:nth-of-type(2)>.txt-box{ background-color: var(--color_2); } .content:nth-of-type(3)>.txt-box{ background-color: var(--color_4); } .txt-box>h2{ font-size: 30px; margin-bottom: 40px; } .txt-box>.txt{ margin-bottom: 50px; line-height: 2; } .btn{ width: 60%; height: 50px; margin: 0 auto; background-color: #FFF; } .btn>a{ display: block; line-height: 50px; text-align: center; color: #222; } .btn>a::after{ display: inline-block; content: ""; width: 10px; height: 10px; border-top: 1px solid #222; border-right: 1px solid #222; transform: rotate(45deg); margin-left: 20px; transition: 0.1s } .btn>a:hover::after{ transform: translateX(20px) rotate(45deg); } .col-1{ width: 100%; height: 500px; background-color: var(--color_3); margin-bottom: 10px; text-align: center; padding: 100px; } .col-1>h2{ margin-bottom: 40px; line-height: 2; } .col-1>.txt{ margin-bottom: 30px; line-height: 2; } /* col-3部分 */ .col-3-wrapper{ display: flex; justify-content: space-between; margin-bottom: 10px; } .col-3-box{ width: calc((100% - 20px) / 3); } .col-3-img{ width: 100%; height: 240px; } .col-3-img>img{ object-fit: cover; object-position: center 70%; width: 100%; height: 100%; } .col-3-txt{ width: 100%; height: 300px; padding: 40px; background-color: var(--color_3); } .col-3-box:nth-of-type(2)>.col-3-txt{ background-color: var(--color_2); } .col-3-box:nth-of-type(3)>.col-3-txt{ background-color: var(--color_4); } .col-3-txt>h2{ text-align: center; margin-bottom: 20px; } .icon{ width: 80px; height: 80px; margin: 0 auto 30px; background-color: #FFF; border-radius: 50%; padding: 16px; } footer{ width: 100%; height: 100px; background-color: var(--color_1); } footer>p{ text-align: center; line-height: 100px; font-size: 20px; } #g-nav-sp,#ham-btn{ display: none; } /* 900px以下でのスタイル */ @media (max-width:900px){ header{ height: 80px; position: fixed; top: 0; left: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; } h1{ line-height: 80px; } #ham-btn{ display: block; } #g-nav-sp{ position: fixed; top: 80px; left: 0; z-index: 10; width: 100%; height: calc(100vh - 80px); background-color: var(--color_2); padding: 40px; } #g-nav-sp li{ margin-bottom: 10px; position: relative; } #g-nav-sp li::after{ display: block; content: ""; width: 8px; height: 8px; border-top: 1px solid #222; border-right: 1px solid #222; transform: rotate(45deg); position: absolute; top: 0; bottom: 4px; right: 20px; margin: auto; } #g-nav-sp a{ display: block; border-bottom: 1px solid #222; color: #222; padding: 8px 0 8px 20px; } #g-nav{ display: none; } .container{ margin-top: 90px; } /* content部分 */ .txt-box{ padding: 20px; } .txt-box>h2{ font-size: 22px; } /* col-3部分 */ .col-3-wrapper{ display: block; } .col-3-box{ width: 100%; display: flex; margin-bottom: 10px; } .col-3-img{ width: 50%; height: 300px; } .col-3-txt{ width: 50%; } } /* 767px以下のレイアウト */ @media (max-width:767px){ h1{ text-align: left; padding-left: 30px; } /* content部分 */ .content{ display: block; } .photo-box{ width: 100%; height: 300px; } .txt-box{ width: 100%; } .txt-box>h2{ text-align: center; } .col-1{ height: auto; padding: 20px; } .col-3-box{ display: block; } .col-3-img{ width: 100%; height: 240px; } .col-3-txt{ width: 100%; } }