フルスクリーン - グラデーション
girlydrop.com
テキスト
ヒーローイメージ | The Web Design
The Web Design
Portfolio
About
Contact
Portfolio
© The Web Design
HTMLコーディング
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>【コーディング練習】The Web Design</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=Caveat:wght@400..700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="css/style.css"> </head> <body id="top"> <!-- .header --> <header class="header"> <div class="container"> <h1>The Web Design</h1> <nav class="gnav"> <ul> <li><a href="#">Portfolio</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> </div><!-- /.container --> </header> <!-- /.header --> <!-- .main-content --> <main class="main"> <a href="#" class="prof">Portfolio</a> </main> <!-- /.main --> <!-- .footer --> <footer class="footer"> <p><small>© The Web Design</small></p> </footer> <!-- /.footer --> </body> </html>
CSSコーディング
@charset "UTF-8"; /* ------------------------------------------ reset ------------------------------------------ */ *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; } ul, li { list-style: none; } a { color: inherit; text-decoration: none; } img { max-width: 100%; vertical-align: bottom; } /* ------------------------------------------ body ------------------------------------------ */ body { color: #fff; font-size: 16px; font-family: Arial, sans-serif; line-height: 1.0; } #top { width: 100%; height: 100vh; background: linear-gradient(25deg, rgba(178, 5, 5, 0.6), rgba(4, 160, 4, 0.6)), url(../img/grass.webp); background-repeat: no-repeat; background-position: center center; background-size: cover; } /* ------------------------------------------ layout ------------------------------------------ */ .container { display: flex; align-items: center; } /* ------------------------------------------ header ------------------------------------------ */ .header { position: fixed; top: 0; width: 100%; } .container { width: min(92%, 960px); margin: auto; text-align: center; } .header h1 { padding-top: 2vh; margin: 0 auto 1.5vh 0; font-size: 3.6em; font-family: 'Caveat', cursive; } .gnav ul { display: flex; justify-content: center; gap: 30px; } .gnav li { font-size: 1.2em; } .gnav a:hover { border-bottom: 2px solid #fff; padding-bottom: 2px; } /* ------------------------------------------ main ------------------------------------------ */ .main { display: flex; align-items: center; width: min(92%, 960px); height: 100vh; margin: 0 auto; text-align: center; } a.prof { display: inline-block; margin: auto; padding: 10px 40px; border: 2px solid #fff; font-size: 18px; font-weight: 600; text-align: center; letter-spacing: .08em; } a.prof:hover { background-color: rgba(189, 19, 19, 0.5); } /* ------------------------------------------ footer ------------------------------------------ */ .footer { position: fixed; bottom: 0; width: 100%; height: 50px; text-align: center; }