WEBサイト制作の勉強

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

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

7月5日の作業データ(レストランサイト)完成版

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>restaurant-site</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=Josefin+Sans:ital@1&family=M+PLUS+Rounded+1c&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">
<link rel="apple-touch-icon" href="touch-icon.png">
<link rel="shortcut icon" href="favicon.png">
</head>
<body>
<header>
<h1><img src="img/logo.svg" alt=""></h1>
</header>
<p class="hamburger hamburger--stand" id="btn">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</p>
<nav id="g-nav">
<ul>
<li><a href="#">トップ</a></li>
<li><a href="#news">お知らせ</a></li>
<li><a href="#movie">ムービー</a></li>
<li><a href="#gallery">ギャラリー</a></li>
<li><a href="#info">インフォメーション</a></li>
<li><a href="#form">お問い合わせ</a></li>
</ul>
</nav>

<div class="main-visual">
<ul class="bxslider">
<li><img src="img/slide-01.jpg" alt=""></li>
<li><img src="img/slide-02.jpg" alt=""></li>
<li><img src="img/slide-03.jpg" alt=""></li>
</ul>
</div>


<main>
<div id="news">
<h2 data-en="News">お知らせ</h2>
<dl id="news-list">

</dl>
<p id="more-btn"><a href="#">もっと見る</a></p>
</div><!-- /#news -->


<div id="movie">
<h2 data-en="Movie">ムービー</h2>
<div class="video-wrapper">
<video src="img/movie.mp4" controls></video>
</div>
<div class="yt-wrapper">
<iframe class="y-tube" src="https://www.youtube.com/embed/eowVg3lWIQk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div><!-- /.yt-wrapper -->
</div><!-- /#movie -->


<div id="gallery">
<h2 data-en="Gallery">ギャラリー</h2>
<div class="gallery-wrapper">
<div class="gallery-box">
<h3 class="heading01">Lorem, ipsum</h3>
<p><a href="img/01.jpg" data-lightbox="gallery"><img src="img/01.jpg" alt=""></a></p>
</div><!-- /.gallery-box -->

<div class="gallery-box">
<h3 class="heading01">Lorem, ipsum</h3>
<p><a href="img/02.jpg" data-lightbox="gallery"><img src="img/02.jpg" alt=""></a></p>
</div><!-- /.gallery-box -->

<div class="gallery-box">
<h3 class="heading01">Lorem, ipsum</h3>
<p><a href="img/03.jpg" data-lightbox="gallery"><img src="img/03.jpg" alt=""></a></p>
</div><!-- /.gallery-box -->
</div><!-- /.gallery-wrapper -->
</div><!-- /#gallery -->



<div id="info">
<h2 data-en="Information">インフォメーション</h2>
<div class="info-wrapper">
<div class="tw">
<a class="twitter-timeline" data-width="320" data-height="500" data-theme="light" href="https://twitter.com/city_toshima?ref_src=twsrc%5Etfw">Tweets by city_toshima</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<div class="map">
<iframe class="g-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3238.9454663323195!2d139.7121211499927!3d35.72755968008629!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x60188d68f6cfe057%3A0xddd17dcd7ecaf745!2z6LGK5bO25Yy656uL5Y2X5rGg6KKL5YWs5ZyS!5e0!3m2!1sja!2sjp!4v1656383900346!5m2!1sja!2sjp" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
</div><!-- /.info-wrapper -->
</div><!-- /#info -->


<div id="form">
<h2 data-en="Form">お問い合せ</h2>
<div class="form-wrapper">
<iframe class="g-form" src="https://docs.google.com/forms/d/e/1FAIpQLSddB3BecnL5eHITYfoVHkzQP_3Ut2K-rj4NZNvmJZoSfAlAaA/viewform?embedded=true" height="1200" frameborder="0" marginheight="0" marginwidth="0">読み込んでいます…</iframe>
</div><!-- /.form-wrapper -->
</div><!-- /#form -->
</main>
<footer>
<p><small>&copy; 2018 - <span id="thisYear"></span> felica</small></p>
<ul class="sns">
<li><img src="img/twitter-brands.svg" alt=""></li>
<li><img src="img/instagram-brands.svg" alt=""></li>
<li><img src="img/line-brands.svg" alt=""></li>
</ul>
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="js/jquery.bxslider.js"></script>
<script src="js/lightbox.js"></script>
<script>
$(function(){
//ハンバーガー
$('#btn').on('click',function(){
$(this).toggleClass('is-active');
//#g-navをfadeToggle
$('#g-nav').toggleClass('click');
});
//ナビゲーション部分
//#g-nav aをon.clcikしたら
$('#g-nav a').on('click',function(){
//#g-navについている「.click」をremoveClassする
$('#g-nav').removeClass('click');
//#btnについている「.is-active」をremoveClassする
$('#btn').removeClass('is-active');
});


//bxslider
$('.bxslider').bxSlider({
mode: 'fade',//画像の切り替わり方
auto: true,//trueがon
controls: false,//falseはoff
pager: false,
speed: 2000,
pause: 2000,
});

//newsデータの呼び出し
$('#news-list').load('news.txt');

//西暦の取得
let today = new Date().getFullYear();
console.log(today);
$('#thisYear').text(today);
});
</script>

</body>
</html>


style.css

@charset "utf-8";
:root{
--color:#e44616;
--ja:'M PLUS Rounded 1c', sans-serif;
--en:'Josefin Sans', sans-serif;
}


html{box-sizing:border-box;-webkit-text-size-adjust:100%}*,:after,:before{background-repeat:no-repeat;box-sizing:inherit}:after,:before{text-decoration:inherit;vertical-align:inherit}*{padding:0;margin:0;box-sizing:border-box;}audio:not([controls]){display:none;height:0}hr{overflow:visible}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}summary{display:list-item}small{font-size:80%}[hidden],template{display:none}abbr[title]{border-bottom:1px dotted;text-decoration:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}code,kbd,pre,samp{font-family:monospace,monospace}b,strong{font-weight:bolder}dfn{font-style:italic}mark{background-color:#ff0;color:#000}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}input{border-radius:0}[role=button],[type=button],[type=reset],[type=submit],button{cursor:pointer}[disabled]{cursor:default}[type=number]{width:auto}[type=search]{-webkit-appearance:textfield}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}textarea{overflow:auto;resize:vertical}button,input,optgroup,select,textarea{font:inherit}optgroup{font-weight:700}button{overflow:visible}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:0;padding:0}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button:-moz-focusring{outline:1px dotted ButtonText}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}button,select{text-transform:none}button,input,select,textarea{background-color:transparent;border-style:none;color:inherit}select{-moz-appearance:none;-webkit-appearance:none}select::-ms-expand{display:none}select::-ms-value{color:currentColor}legend{border:0;color:inherit;display:table;max-width:100%;white-space:normal}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}img{border-style:none;vertical-align: bottom}progress{vertical-align:baseline}svg:not(:root){overflow:hidden}audio,canvas,progress,video{display:inline-block}@media screen{[hidden~=screen]{display:inherit}[hidden~=screen]:not(:active):not(:focus):not(:target){position:absolute!important;clip:rect(0 0 0 0)!important}}[aria-busy=true]{cursor:progress}[aria-controls]{cursor:pointer}[aria-disabled]{cursor:default}::-moz-selection{background-color:#b3d4fc;color:#000;text-shadow:none}::selection{background-color:#b3d4fc;color:#000;text-shadow:none}ul,ol{list-style:none;}a{text-decoration:none;}.wrapper{overflow:hidden;}body{overflow-y:scroll;}img{max-width: 100%;}

/* pcレイアウト */

header{
width: 100%;
height: 100vh;
background-color: #FFFFFF66;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
h1{
width: 360px;
position: absolute;
top: 60px;
left: 100px;
}


/* ナビゲーション部分 */
#g-nav{
width: 50%;
height: 100vh;
background-color: #444040;
position: fixed;
left: 0;
top: 0;
z-index: 2;
transform: translateX(-100%);
transition: 0.3s;
}
#g-nav.click{
transform: translateX(0);
}
#g-nav>ul{
padding: 50px;
}
#g-nav li{
margin-bottom: 20px;
}
#g-nav a{
display: block;
color: #FFF;
padding: 10px 0;
overflow: hidden;
}
/* #g-nav a:hover{
text-decoration: underline 4px #ef9292;
text-underline-offset: 4px;
} */
#g-nav a::after{
content: "";
display: block;
width: 50%;
height: 4px;
background-color: #ef9292;
/* transform: scale(0); */
transform: translateX(-110%);
transition: 0.2s;
}
#g-nav a:hover::after{
/* transform: scale(1); */
transform: translateX(0);
}



#btn{
position: fixed;
right: 0;
top: 0;
z-index: 3;
background-color: #FFF;
}



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

/* 共通部分 */
h2{
text-align: center;
padding: 40px 0;
font-family: var(--ja);
font-size: 32px;
}
h2::after{
content: attr(data-en);
display: block;
font-size: 20px;
color: var(--color);
font-family: var(--en);
}

/* お知らせ部分 */
#news>dl{
max-width: 800px;
padding: 0 10px;
margin: 0 auto 40px;
display: flex;
flex-wrap: wrap;
}
#news dt{
width: 30%;
border-bottom: 2px solid var(--color);
margin-bottom: 20px;
padding: 10px;
font-weight: bold;
}
#news dd{
width: 70%;
border-bottom: 2px solid var(--color);
margin-bottom: 20px;
padding: 10px;
}

#news dt:nth-of-type(n+4),#news dd:nth-of-type(n+4){
display: none;
}



#more-btn{
width: 240px;
height: 44px;
margin: 0 auto 150px;
}
#more-btn>a{
display: block;
text-align: center;
line-height: 44px;
background-color: var(--color);
color: #FFF;
border-radius: 6px;
}
#more-btn>a::after{
content: "→";
display: inline-block;
margin-left: 1em;
}
#more-btn>a:hover{
text-indent: 1em;
transition: 0.2s;
}




/* ムービー部分 */
.video-wrapper{
width: 60%;
height: 80vh;
margin: 0 auto 100px;
}
.video-wrapper>video{
object-fit: cover;
width: 100%;
height: 100%;
}
.yt-wrapper{
width: 60%;
height: 80vh;
margin: 0 auto 100px;
}
.y-tube{
width: 100%;
height: 100%;
}

/* ギャラリー部分 */
.gallery-wrapper{
max-width: 960px;
padding: 0 10px;
margin: 0 auto 100px;
display: flex;
justify-content: space-between;
}
.gallery-box{
width: calc((100% - 40px) / 3);
}
.heading01 {
display: inline;
font-size: 24px;
background-image: linear-gradient(rgba(0,0,0,0) 70%, var(--color) 70%);
}
.gallery-box>p{
margin-top: 16px;
}

/* インフォ部分 */
.info-wrapper{
max-width: 960px;
padding: 0 10px;
margin: 0 auto 100px;
display: flex;
justify-content: space-between;
}
.tw{
width: 320px;
}
.map{
width: calc(100% - 400px);
height: 500px;
}
.g-map{
width: 100%;
height: 100%;
filter: grayscale(1);
}
/* フォーム部分 */
.form-wrapper{
max-width: 640px;
margin: 0 auto 100px;
}
.g-form{
width: 100%;
}
/* footer部分 */
footer{
width: 100%;
background-color: var(--color);
padding-bottom: 50px;
}
footer>p{
color: #ffffff;
text-align: center;
padding: 30px 0;
font-size: 20px;
}
.sns{
display: flex;
justify-content: center;
}
.sns>li{
width: 40px;
margin: 0 14px;
}



/* 767px以下の時 */
@media (max-width:767px){

/* インフォ部分 */
.info-wrapper{
margin: 0 auto 100px;
display: block;
}
.tw{
margin: 0 auto 70px;
}
.map{
width:100%;
height: 300px;
}
}

/* 640px以下の時 */
@media (max-width:640px){

h1{
width: 180px;
position: absolute;
top: 10px;
left: 10px;
}
#g-nav>ul{
padding: 10px;
}
#g-nav li{
margin-bottom: 10px;
}

/* お知らせ部分 */
#news>dl{
margin: 0 auto 40px;
display: block;
}
#news dt{
width: 50%;
margin-bottom: 0;
}
#news dd{
width: 100%;
margin-bottom: 40px;
}

/* ムービー部分 */
.video-wrapper,.yt-wrapper{
width: 90%;
}

/* ギャラリー部分 */
.gallery-wrapper{
margin: 0 auto 100px;
display: block;
}
.gallery-box{
width: 100%;
margin-bottom: 50px;
}

}