WEBサイト制作の勉強

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

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

4月12日作業データ(カフェのシングルページ)

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>シングルページのカフェサイト</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/jquery.bxslider.css">
<link rel="stylesheet" href="css/lightbox.css">
<link rel="stylesheet" href="css/hamburgers.css">
</head>
<body>
<header>
<h1>Cafe de FELICA</h1>
</header>
<nav id="g-nav">
<ul>
<li><a href="#">TOP<span>トップ</span></a></li>
<li><a href="#news">NEWS<span>お知らせ</span></a></li>
<li><a href="#movie">MOVIE<span>動画</span></a></li>
<li><a href="#menu">MENU<span>メニュー</span></a></li>
<li><a href="#shop">SHOP<span>店舗情報</span></a></li>
</ul>
<div class="sns">
<p><img src="img/twitter-brands.svg" alt=""></p>
<p><img src="img/instagram-brands.svg" alt=""></p>
<p><img src="img/line-brands.svg" alt=""></p>
</div>
</nav>

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


<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>

<div class="main-copy">
<h2>Cafe de Felicaは食とアートと音楽が交差する空間を創造します。</h2>
<p>シェフ・矢島が提供するのは、スペイン料理に「東京」のエッセンスを取り入れたモダンスパニッシュ。<br>
店内は、新進気鋭のアーティストとコラボレーションしたアートギャラリー。<br>
心地よいチルアウトミュージックが流れる空間でくつろぎのひとときをお過ごしください。</p>
</div>

<main>
<div id="news" class="content">
<h2>NEWS</h2>
<dl id="news-list">
</dl>
</div><!-- /#news -->

<div id="movie" class="content">
<h2>MOVIE</h2>
<div class="movie-inner">
<video src="img/movie.mp4" controls></video>
</div>
</div><!-- /#movie -->

<div id="menu" class="content">
<h2>MENU</h2>
<div class="menu-wrapper">
<div class="menu-box">
<h3 class="heading03">menu-1</h3>
<a href="img/menu-01.jpg" data-lightbox="menu" data-title="menu-01の画像の説明文"><img src="img/menu-01.jpg" alt=""></a>
</div><!-- /.menu-box -->

<div class="menu-box">
<h3 class="heading03">menu-2</h3>
<a href="img/menu-02.jpg" data-lightbox="menu" data-title="menu-02の画像の説明文"><img src="img/menu-02.jpg" alt=""></a>
</div><!-- /.menu-box -->

<div class="menu-box">
<h3 class="heading03">menu-3</h3>
<a href="img/menu-03.jpg" data-lightbox="menu" data-title="menu-03の画像の説明文"><img src="img/menu-03.jpg" alt=""></a>
</div><!-- /.menu-box -->

<div class="menu-box">
<h3 class="heading03">menu-4</h3>
<a href="img/menu-04.jpg" data-lightbox="menu" data-title="menu-04の画像の説明文"><img src="img/menu-04.jpg" alt=""></a>
</div><!-- /.menu-box -->

</div><!-- /.menu-wrapper -->
</div><!-- /#menu -->


<div id="shop" class="content">
<h2>SHOP</h2>
<div class="shop-wrapper">
<dl class="shop-list">
<dt>住所</dt>
<dd>東京都豊島区南池袋x-x-x</dd>
<dt>電話番号</dt>
<dd><a href="tel:0312345678">03-1234-5678</a></dd>
<dt>席数</dt>
<dd>100席</dd>
<dt>営業時間</dt>
<dd>11:00~22:00</dd>
<dt>定休日</dt>
<dd>水曜日</dd>
</dl>
<div class="sns-box">
<a class="twitter-timeline" data-width="300" data-height="400" 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><!-- /.sns-box -->
</div><!-- /.shop-wrapper -->
<div class="map-box">
<iframe class="g-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3238.945289249687!2d139.7121265146523!3d35.727564035038164!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x60188d68f6cfe057%3A0xddd17dcd7ecaf745!2z6LGK5bO25Yy656uL5Y2X5rGg6KKL5YWs5ZyS!5e0!3m2!1sja!2sjp!4v1649731647776!5m2!1sja!2sjp" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div><!-- /.map-box -->
</div><!-- /#shop -->
</main>

<footer>
<p><small>&copy; 2017-<span id="this-year"></span> Cafe de FELICA</small></p>
</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(){
$('.bxslider').bxSlider({
pager: false,
mode: 'fade',
auto: true,
});


//外部ファイルを呼び出す
$('#news-list').load('news.txt');

//西暦を取得し表示
var today = new Date();
console.log(today);
var myYear = today.getFullYear();//西暦のみを取得
console.log(myYear);
$('#this-year').text(myYear);

//ハンバーガー
$('#btn').on('click',function(){
$(this).toggleClass('is-active');
$('#g-nav').toggleClass('click');
});

//メニューを隠す
$('#g-nav a').on('click',function(){
$('#g-nav').removeClass('click');
$('#btn').removeClass('is-active');
});


});
</script>
</body>
</html>


style.css

@charset "utf-8";

:root{
--main_color:#ac052f;
}

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部分 */
header{
display: none;/* 要素を非表示 */
}
/* ナビゲーション部分 */
#g-nav{
/* display: none; */
position: fixed;
top: 0;
right: 0;
z-index: 9999;
width: 50%;
height: 100vh;
background-color: var(--main_color);
transform: translateX(100%);
transition: 0.3s;
padding:100px;
}
#g-nav.click{
transform: translateX(0);
}
#g-nav li{
margin-bottom: 30px;
}
#g-nav a{
display: block;
color: #FFF;
font-size: 24px;
border-bottom: 2px solid #FFF;
padding: 0 0 10px 20px;
}
#g-nav span{
font-size: 18px;
padding-left: 10px;
}
#g-nav a:hover{
text-decoration: underline 4px #efd275;
text-underline-offset: 3px;
}
.sns{
width: 220x;
background-color: #FFF;
display: flex;
justify-content: space-between;
padding: 20px;
}
.sns>p{
width: 40px;
}




/* ハンバーガー部分 */
#btn{
position: fixed;
right: 0;
top: 0;
z-index: 9999;
background-color: #FFFFFFa7;
}


/* main-visual部分 */
.main-visual{
width: 100%;
height: 75vh;
margin-bottom: 50px;
}
.main-visual li{
width: 100%;
height: 75vh;
}
.main-visual img{
object-fit: cover;
object-position: center center;
width: 100%;
height: 100%;
}
/* main-copy部分 */
.main-copy{
text-align: center;
margin-bottom: 100px;
}
.main-copy>h2{
margin-bottom: 40px;
}
.main-copy>p{
line-height: 2;
}

/* メインコンテンツ部分 */
.content>h2{
text-align: center;
padding: 50px 0;
color: var(--main_color);
font-size: 30px;
}

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


/* movie部分 */
.movie-inner{
width: 80%;
height: 70vh;
margin: 0 auto 100px;
}
.movie-inner>video{
object-fit: cover;
width: 100%;
height: 100%;
}

/* menu部分 */
.menu-wrapper{
max-width: 960px;
margin: 0 auto 100px;
display: flex;
flex-wrap: wrap;
gap: 40px 20px;/* 上下、左右の余白の設定 */
}
.menu-box{
width: calc((100% - 40px) / 3);
padding: 10px;
transition: 0.2s;
}
.menu-box:hover{
box-shadow: 0 0 10px #CCC;/* 横、縦、影の距離、影の色 */
}

.menu-box>h3{
margin-bottom: 10px;
}
.heading03 {
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 24px;
	text-align: center;
}

.heading03::before,
.heading03::after {
	content: '';
	width: 70px;
	height: 3px;
	background-color: var(--main_color);
}
.heading03::before {
	margin-right: 20px;
}
.heading03::after {
	margin-left: 20px;
}


/* shop部分 */
.shop-wrapper{
max-width: 800px;
margin: 0 auto 100px;
display: flex;
}
.shop-list{
width: 50%;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.shop-list>dt{
width: 30%;
border-bottom: 1px solid var(--main_color);
padding: 30px 0 0 10px;
}
.shop-list>dd{
width: 70%;
border-bottom: 1px solid var(--main_color);
padding: 30px 0 0 10px;
}
.shop-list a{
pointer-events: none;
color: #222;
}
.sns-box{
margin-left: 50px;
}

.map-box{
max-width: 800px;
height: 500px;
margin:0 auto 100px;
}
.g-map{
width: 100%;
height: 100%;
filter: grayscale(100);
}
.g-map:hover{
filter: grayscale(0);
}

/* footer部分 */
footer{
width: 100%;
height: 100px;
background-color: var(--main_color);
}
footer>p{
text-align: center;
line-height: 100px;
font-size: 20px;
color: #FFF;
}