トップページ記述例
index.html
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Site | 課題サイト</title>
<link rel="stylesheet" href="css/style.css">
<script src="js/script.js" defer></script>
</head>
<body>
<header class="header">
<div class="container">
<h1><a href="index.html"><img src="img/title.svg" alt="課題サイト"></a></h1>
<nav class="gnav" id="gnav">
<ul>
<li><a href="#" class="current">Web Site</a></li>
<li><a href="jsjq.html">JavaScript<br>jQuery</a></li>
<li><a href="psai.html">Photoshop<br>Illustrator</a></li>
<li><a href="other.html">Other</a></li>
</ul>
</nav>
<div class="nav_button" id="navButton">
<span></span>
<span></span>
<span></span>
</div>
</div>
</header>
<main class="main">
<div class="key_visual">
<h2>【Web Site 制作ポイント】</h2>
<ul>
<li>架空のカメラマンが撮影した写真を使用する、というコンセプトでサイト作成</li>
<li>ルールを作成しその基準に則ってコーディング</li>
<li>レイアウトは、display: gid; で指定</li>
<li>PC用のレイアウトから初めて、その後モバイル用の設定を指定</li>
</ul>
</div>
<div class="container">
<ul class="web_site">
<li><a href="01_spain/index.html">
<img src="img/01.webp" alt="01 スペイン観光ガイド">
<h3>01 スペイン観光ガイド</h3>
</a></li>
<li><a href="02_portfolio/index.html">
<img src="img/02.webp" alt="02 ポートフォリオ">
<h3>02 ポートフォリオ</h3>
</a></li>
<li><a href="03_recipe/index.html">
<img src="img/03.webp" alt="03 Recipe Diary">
<h3>03 Recipe Diary</h3>
</a></li>
<li><a href="04_news/index.html">
<img src="img/04.webp" alt="04 NEWS">
<h3>04 NEWS</h3>
</a></li>
<li><a href="05_sightseeing/index.html">
<img src="img/05.webp" alt="05 スペインの魅力">
<h3>05 スペインの魅力</h3>
</a></li>
<li><a href="06_vegetables/index.html">
<img src="img/06.webp" alt="06 旬の野菜便">
<h3>06 旬の野菜便</h3>
</a></li>
<li><a href="07_girly/index.html">
<img src="img/07.webp" alt="07 Girly Style">
<h3>07 Girly Style</h3>
</a></li>
<li><a href="08_foodie/index.html">
<img src="img/08.webp" alt="08 宅配朝食サービス">
<h3>08 宅配朝食サービス</h3>
</a></li>
<li><a href="09_design/index.html">
<img src="img/09.webp" alt="09 The Web Design">
<h3>09 The Web Design</h3>
</a></li>
<li><a href="10_style/index.html">
<img src="img/10.webp" alt="10 MyStyle">
<h3>10 MyStyle</h3>
</a></li>
<li><a href="11_flowerCefe/index.html">
<img src="img/11.webp" alt="11 Flower Coffee">
<h3>11 Flower Coffee</h3>
</a></li>
<li><a href="12_form/index.html">
<img src="img/12.webp" alt="12 IKECODE">
<h3>12 IKECODE</h3>
</a></li>
<li><a href="13_blog/index.html">
<img src="img/13.webp" alt="13 Blog">
<h3>13 Blog</h3>
</a></li>
<li><a href="14_coffee/index.html">
<img src="img/14.webp" alt="14 COFFEE">
<h3>14 COFFEE</h3>
</a></li>
<li><a href="15_start/index.html">
<img src="img/15.webp" alt="15 START">
<h3>15 START</h3>
</a></li>
<li><a href="16_media/index.html">
<img src="img/16.webp" alt="16 メディア">
<h3>16 メディア</h3>
</a></li>
<li><a href="17_sarada/index.html">
<img src="img/17.webp" alt="17 美味しいサラダ">
<h3>17 美味しいサラダ</h3>
</a></li>
<li><a href="18_sousaku/index.html">
<img src="img/18.webp" alt="18 創作">
<h3>18 創作</h3>
</a></li>
</ul>
</div>
</main>
<footer class="footer">
<p id="update">更新日:2024年12月20日</p>
</footer>
</body>
</html>
@charset "UTF-8";
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul {
list-style: none;
}
a {
color: inherit;
text-decoration: none;
}
img {
max-width: 100%;
vertical-align: bottom;
}
html {
font-size: 100%;
scroll-behavior: smooth;
}
body {
display: grid;
grid-template-rows: auto 1fr auto;
min-height: 100vh;
background-color: #fff;
color: #333;
font-size: 16px;
font-family: Arial, sans-serif;
line-height: 1.0;
}
.header {
position: relative;
color: #444;
}
.header > .container {
display: flex;
align-items: center;
width: min(92%, 1240px);
margin: auto;
padding: 10px 0;
}
.header h1 {
width: 160px;
margin-right: auto;
position: relative;
}
.header h1::after {
content: 'by TESHIROGI';
position: absolute;
left: 174px;
bottom: -2px;
font-size: 0.875rem;
line-height: 1.1;
}
@media screen and (max-width: 767px) {
.header > .container {
padding: 9px 0;
}
.header h1 {
width: 100px;
}
.header h1::after {
left: 110px;
bottom: -2px;
font-size: 0.6rem;
}
}
.container {
width: min(94%, 1240px);
margin: 0 auto;
padding-top: 50px;
}
.gnav > ul {
display: flex;
justify-content: center;
align-items: center;
}
.gnav li a {
display: block;
padding: 8px 20px;
font-size: 1.125rem;
line-height: 1.2;
white-space: nowrap;
}
.gnav li:first-of-type a,
.gnav li:last-of-type a {
line-height: 43px;
}
.gnav li a.current {
background-color: #444;
color: #fff;
}
.gnav li a:hover {
background-color: #444;
color: #fff;
}
@media screen and (max-width: 767px) {
.nav_button {
position: fixed;
right: 0;
top: 0;
width: 50px;
height: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
background-color: #fff;
z-index: 1000;
}
.nav_button span {
width: 30px;
height: 3px;
background: #444;
border-radius: 2px;
transition: all 0.2s ease-in-out;
}
.open .nav_button span:nth-child(1) {
transform: translate(0, 8px) rotate(45deg);
background: #444;
}
.open .nav_button span:nth-child(2) {
transform: scaleX(0);
opacity: 0;
}
.open .nav_button span:nth-child(3) {
transform: translate(0, -10px) rotate(-45deg);
background: #444;
}
.gnav {
position: fixed;
right: -100vw;
top: 0;
width: 100vw;
height: 100%;
background-color: rgba(18, 112, 188, 1.0);
color: white;
transition: right 0.3s ease;
z-index: 800;
}
.gnav ul {
display: grid;
place-content: center;
height: 100vh;
}
.gnav ul li {
margin: 15px 0;
text-align: center;
}
.gnav ul li a {
color: white;
text-decoration: none;
}
.open .gnav {
right: 0;
}
}
.footer {
padding: 20px 0;
background-color: #000;
color: #fff;
text-align: center;
}
.key_visual {
padding: 60px 6vw 20px 27vw;
width: 100%;
height: 400px;
background: url(../img/main.webp) no-repeat center center / cover;
color: #333;
}
.key_visual h2 {
margin-bottom: 10px;
}
.key_visual ul {
padding-left: 2.5rem;
list-style-type: disc;
}
.key_visual li {
margin-bottom: 4px;
line-height: 1.3;
}
.web_site{
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
column-gap: 10px;
row-gap: 40px;
margin-top: -200px;
margin-bottom: 40px;
}
.gallery h3 {
padding-left: 2.5rem;
}
@media screen and (max-width: 767px) {
.key_visual {
padding: 20px 1.0rem 0 1.2rem;
width: 100vw;
height: 240px;
background: url(../img/sub.webp) no-repeat left center / cover;
}
.key_visual h2 {
font-size: 0.95rem;
text-align: center;
}
.key_visual ul {
font-size: 0.875rem;
}
.key_visual li {
margin-bottom: 4px;
line-height: 1.2;
}
.web_site{
margin-top: -80px;
}
}
script.js
document.querySelector('#navButton').addEventListener('click', () => {
document.querySelector('html').classList.toggle('open');
});