WEBサイト制作の勉強

WEBサイト制作の勉強の為の解説ブログです。

フェリカテクニカルアカデミー

3月14日の作業データ

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>レストランサイトの作成</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=Stick&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/hamburgers.css">
<link rel="stylesheet" href="css/jquery.bxslider.css">
<link rel="stylesheet" href="css/lightbox.css">
</head>
<body id="top">
<header>
<h1>Trattoria La Famiglia</h1>
<p class="tag-line">家族のように温かい、本場のイタリア料理</p>
<p class="logo"><img src="img/logo.svg" alt=""></p>
</header>

<p class="hamburger hamburger--stand" id="ham-btn">
  <span class="hamburger-box">
    <span class="hamburger-inner"></span>
  </span>
</p>

<nav id="g-nav">
<ul>
<li><a href="#top" data-en="TOP">トップ</a></li>
<li><a href="#news" data-en="NEWS">お知らせ</a></li>
<li><a href="#menu" data-en="MENU">メニュー</a></li>
<li><a href="#video" data-en="VIDEO">動画</a></li>
<li><a href="#shop" data-en="SHOP">店舗情報</a></li>
<li><a href="#reserve" data-en="RESERVE">ご予約</a></li>
</ul>
</nav>

<div class="main-visual">
<ul class="bxslider">
<li><img src="img/main-1.webp" alt=""></li>
<li><img src="img/main-2.webp" alt=""></li>
<li><img src="img/main-3.webp" alt=""></li>
</ul>
</div>

<div class="main-copy">
<h2>ようこそ、家族のように温かいイタリアへ!</h2>
<p class="lead">
Trattoria La Famigliaは、イタリアの家庭料理をアットホームな雰囲気で提供するレストランです。<br>
まるでイタリアの田舎に来たような、温かく親しみやすい空間で、おばあちゃんが作るような素朴で美味しい料理をお楽しみください。<br>
厳選された旬の食材を使い、伝統的なレシピで丁寧に作られた料理は、心も体も温まる美味しさです。</p>
</div>

<div class="gallery">
<p><img src="img/gallery-1.jpg" alt=""></p>
<p><img src="img/gallery-2.jpg" alt=""></p>
</div>

<main>
<section id="news">
<h3 data-en="NEWS">お知らせ</h3>
<dl id="news-list">

</dl>
</section>

<div class="parallax-1"></div>

<section id="menu">
<h3 data-en="MENU">メニュー</h3>
<div class="menu-wrapper">
<div class="menu-box">
<a href="img/menu-1.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-1.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
<div class="menu-box">
<a href="img/menu-2.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-2.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
<div class="menu-box">
<a href="img/menu-3.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-3.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
<div class="menu-box">
<a href="img/menu-4.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-4.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
<div class="menu-box">
<a href="img/menu-5.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-5.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
<div class="menu-box">
<a href="img/menu-6.jpg" data-lightbox="photo">
<p class="menu-photo"><img src="img/menu-6.jpg" alt=""></p>
<p class="menu-txt">Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis, necessitatibus?</p>
</a>
</div><!-- /.menu-box -->
</div><!-- /.menu-wrapper -->
</section>

<section id="video">
<h3 data-en="VIDEO">動画</h3>
<div class="video-wrapper">
<iframe src="https://www.youtube.com/embed/toQ5bMf8mfw?si=qL3gYB4KltAxcIFF" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div><!-- /.video-wrapper -->
</section>

<section id="shop">
<h3 data-en="SHOP">店舗情報</h3>
<div class="shop-wrapper">
<div class="map-wrapper">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3238.9452895590807!2d139.7117402746393!3d35.72756402742931!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x60188d68f6cfe057%3A0xddd17dcd7ecaf745!2z6LGK5bO25Yy656uL5Y2X5rGg6KKL5YWs5ZyS!5e0!3m2!1sja!2sjp!4v1710385754427!5m2!1sja!2sjp" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div><!-- /.map-wrapper -->

<div class="shop-info">
<dl>
<dt>171-11xx</dt>
<dd>東京都豊島区南池袋x-x-x</dd>
<dt>Tel</dt>
<dd class="tel"><a href="tel:03-1111-xxxx">03-1111-xxxx</a></dd>
<dt>Mail</dt>
<dd>example@gmail.com</dd>
</dl>

<dl>
<dt>Open</dt>
<dd>11:00 — 23:00</dd>
<dt>定休日</dt>
<dd>年末年始</dd>
<dt>駐車場</dt>
<dd>5台</dd>
</dl>
</div><!-- /.shop-info -->
</div><!-- /.shop-wrapper -->
</section>

<div class="parallax-2"></div>

<section id="reserve">
<h3 data-en="RESERVE">ご予約</h3>
</section>
</main>
<footer>

</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="js/jquery.bxslider.js"></script>
<script src="js/lightbox.js"></script>
<script>
$(function(){
//ハンバーガーボタン
//#ham-btnをon.clickしたらthisに「is-active」をtoggleClassさせる
$('#ham-btn').on('click',function(){
$(this).toggleClass('is-active');
});


//メインビジュアル
$('.bxslider').bxSlider({
mode: 'fade',//画像の切り替わり方
auto: true,//trueがon
controls: false,//falseがoff
pager: false,
speed: 2000,//画像が切り替わる時間
pause: 2000,//画像が止まっている時間
});

//ajaxで外部データを呼び出す
$('#news-list').load('news.txt');



});
</script>
</body>
</html>
style.css
@charset "utf-8";

/* 変数の登録 */
:root{
--font_ja:"Stick", sans-serif;
--font_en:"Ubuntu", sans-serif;
--color_1:#297884;
--color_2:#e8ba3c;
--bg_1:#000;
}


*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul{
list-style: none;
}
a{
text-decoration: none;
}
img{
vertical-align: bottom;
max-width: 100%;
}
body{
color: #333;
}


header{
background-color: #d7ea91dc;
width: fit-content;/* 幅が中身の幅に合う */
position: absolute;
top: 80px;
left: 60px;
z-index: 10;
padding: 80px 40px 40px;

>h1{
font-family: var(--font_en);
margin-bottom: 20px;
font-size: 38px;
}
>.tag-line{
font-family: var(--font_ja);
font-size: 22px;
}
}


#g-nav{
display: none;
}

/* ロゴを回す */
.logo{
width: 160px;
position: absolute;
right: -70px;
top: -50px;
animation: logo-anime 7s infinite linear;
}

@keyframes logo-anime{
0%{rotate: 0;}
100%{rotate: 360deg;}
}



/* ハンバーガーボタン */
#ham-btn{
position: fixed;
top: 0;
right: 0;
z-index: calc(infinity);
background-color: #FFF;
}


/* メインビジュアル部分 */
.main-visual{
width: 100%;
height: 100vh;
margin-bottom: 140px;
}
.main-visual li{
width: 100%;
height: 100vh;
>img{
object-fit: cover;
width: 100%;
height: 100%;
}
}

/* メインコピー部分 */
.main-copy{
text-align: center;
font-family: var(--font_ja);
margin-bottom: 140px;
>h2{
font-size: 34px;
margin-bottom: 40px;
}
>.lead{
font-size: 22px;
max-width: 680px;
margin: 0 auto;
line-height: 2.2;
text-align: left;
}
}

/* ギャラリー部分 */
.gallery{
max-width: 600px;
margin: 0 auto 140px;
position: relative;/* positionの基準点 */
>p:nth-of-type(1){
box-shadow: 20px 20px 0 var(--color_1);
}
>p:nth-of-type(2){
width: 50%;
position: absolute;
right: -100px;
bottom: -100px;
box-shadow: 20px 20px 0 var(--color_2);/* 横、縦、影の距離、影の色 */
}
}


/* セクション部分 */
section{
padding: 100px 10px;

>h3{
text-align: center;
font-family: var(--font_ja);
color: var(--color_1);
font-size: 34px;
margin-bottom: 50px;
&::before{
display: block;
content: attr(data-en);
font-family: var(--font_en);
font-size: 28px;
color: var(--color_2);
}
}
}


/* お知らせ部分 */
#news-list{
max-width: 600px;
margin: 0 auto 140px;
display: flex;
flex-wrap: wrap;
font-size: 20px;
>dt{
width: 30%;
margin-bottom: 20px;
border-bottom: 2px solid var(--color_1);
padding: 5px 10px;
&:nth-of-type(n+4){
display: none;
}
}
>dd{
width: 70%;
margin-bottom: 20px;
border-bottom: 2px solid var(--color_1);
padding: 5px 10px;
&:nth-of-type(n+4){
display: none;
}
}
}


/* パララックス部分 */
.parallax-1{
width: 100%;
height: 70vh;
background: url(../img/parallax-1.webp) no-repeat center center/cover fixed;
}
.parallax-2{
width: 100%;
height: 70vh;
background: url(../img/parallax-2.webp) no-repeat center center/cover fixed;
}

/* メニュー部分 */
.menu-wrapper{
width: 90%;
margin: 0 auto 140px;
display: flex;
gap: 80px 40px;/* 上下、左右 */
flex-wrap: wrap;/* 折り返しの指定 */
}
.menu-box{
width: calc((100% - 80px) / 3 );/* 全部から必要な余白を引いて、3で割る */
border: 1px solid #5d5d5d;
padding: 16px;
>a{
color: #222;
&:hover img{
scale: 1.2;
transition: 0.2s;
}
>.menu-photo{
margin-bottom: 10px;
overflow: hidden;
}
>.menu-txt{
line-height: 1.6;
}
}
}


/* 動画部分 */
.video-wrapper{
width: 70%;
aspect-ratio: 16/9;
margin: 0 auto;
>iframe{
width: 100%;
height: 100%;
}
}


/* 店舗情報部分 */
.shop-wrapper{
max-width: 960px;
margin: 0 auto;
}
.map-wrapper{
width: 100%;
aspect-ratio: 2/0.8;
margin-bottom: 80px;
>iframe{
width: 100%;
height: 100%;
}
}

.shop-info{
display: flex;
>dl{
width: 50%;
display: flex;
flex-wrap: wrap;
>dt{
width: 25%;
margin-bottom: 20px;
}
>dd{ 
width: 75%;
margin-bottom: 20px;
}
}
}

/* 電話番号の設定 */
.tel>a{
pointer-events: none;
color: #333;
font-size: 24px;
}
news.txt
<dt>2024年3月17日</dt>
<dd>新メニューのご提供</dd>
<dt>2024年3月16日</dt>
<dd>お客様感謝祭開催!</dd>
<dt>2024年3月15日</dt>
<dd>春のワインフェア開催</dd>
<dt>2024年3月14日</dt>
<dd>ホワイトデー限定メニューのご提供</dd>
<dt>2024年3月10日</dt>
<dd>春の食材を使った特別コースのご提供</dd>
<dt>2024年3月09日</dt>
<dd>営業時間変更のお知らせ</dd>