スマートフォン用のCSSが終わったら、次はPC用のCSSで継承部分や追加した部分の修正をします。
Chap17に収まらなかったため、Chap18-1でレスポンシブデザイン実践の完結編に内容が変更となりました。
また、「index_pc.css」の編集作業分に関して、Chap17-5ページを用意して、講座内容の補足をしています。

作成の流れは動画の「Chap17-4」➡︎「Chap18-1 layout_pc.css(09:00)まで」➡︎「Chap17-5」➡︎「Chap18-1(09:15)から 」となっています。
このページでは「Chap17-4」➡︎「Chap17-4.5」➡︎「Chap17-5」➡︎「Chap17-4.5」という順番です。
layout_pc.cssファイルを編集
layout_pc.cssで継承と書き換え

ここで難しいのは、値の書き換えです。
スマートフォン用で追加したプロパティをそのままにしていると、PC用のデザインでも継承されてしまいます。
そもそも、PC用のデザインに無いプロパティをスマートフォン用で追加したので、ここでは値を初期値などで書き換えていく作業が必要になります。
@media screen and (min-width:960px){
/* 共通デザイン */
/* body{
font-family:"Helvetica Neue", "Helvetica", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Arial", "Yu Gothic", "Meiryo", sans-serif;
line-height: 160%;
color: rgb(90,90,90);
} */
/* img{
width:100%;
max-width: 100%;
height: auto;
} */
h2{
font-size: 28px;
/* font-weight: bold;
color: rgb(185,125,75);
line-height: 150%;
text-align: center; */
width: 960px;
/* margin: 0 auto 30px; */
/* border-bottom: 2px solid rgb(185,125,75); */
}
/* h3{
font-size: 21px;
padding-bottom: 10px;
} */
/* .cont_link,
.cont_link:visited{
color: rgb(0, 60, 255);
text-decoration: underline;
} */
/* 共通レイアウト */
/* header,
nav,
main,
section,
section>div,
footer{
width: 100%;
} */
/* ヘッダー */
header{
/* background-color: rgb(210,180,175); */
padding-top: 10px;
display: grid;
grid-template-columns: 1fr 280px 1fr;
grid-template-rows: 80px 1fr 1fr;
position: sticky;
top: 0;
/* box-shadow: 0px 1px 5px rgba(0,0,0,0.45); */
position: static;
}
header>p{
z-index: 10;
grid-area: 1 / 2 / 3 / 3;
width: 100%;
margin: 0;
position: static;
top: 0;
}
/* ナビゲーション */
nav{
display: block;
background-color: rgb(255,255,255);
padding-top: 30px;
grid-area: 2 / 1 / 4 / 4;
}
nav ul{
padding: 0;
display: flex;
flex-flow: row nowrap;
justify-content: space-around;
width:960px;
margin: auto;
list-style-type: none;
}
nav a{
display: block;
padding: 20px 10px;
}
nav a:link,a:visited{
color:rgb(51,51,51);
text-decoration: none;
}
nav a:hover{
background-color:rgb(255,210,210) ;
color: rgb(200,50,0);
}
/* フッター */
/* footer{
background-color: rgb(210,180,175);
padding: 40px 0 25px 0;
}
footer p{
text-align: center;
font-size: 14px;
} */
}
53,56行目 「positionの追加」を「追加しない」にするには、値を”static”にします。
58行目 「width:40vw」はスマホ用で、元に戻すには値を”100%”にします。
59行目 「margin:auto」はそのままでも問題ないですが、不要なので「0」です。
61行目 「top:7.6vw」もスマホ用のレイアウトなので、PCでは不要になり「0」にします。
66行目 「display:none」でnavを非表示していましたが、表示するには値を”block”にします。

作業の続きになる「index_pc.css」へは上のボタンから、
動画の続きは下の「2>」の、次のページへ進んでください。

