【困っていること】
ポートフォリオサイトを製作しています。
そこでheaderにnavを付けたのですが、cssは同じなのに、1ページ目と2ページ目でheaderの中の左上のロゴやliの配置や大きさが変わってしまいます。
分かる方がいましたら、見づらいコードだとは思いますが、ご教授をお願いします。
【試したこと】
headerに関わるあらゆるcssを変更しました(font-sizeやmargin、paddingを%→pxしたり、widthやheightを変えたり、cssを1つずつ消して変わり具合を確認したりしました)が、どれも解決しなかったです。
html
1<!DOCTYPE html> 2<html lang="en"> 3<head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <title>Rei port</title> 7 <link rel="stylesheet" href="style.css"> 8</head> 9<body> 10 <div id = "wrapper"> 11 <header class="top-header"> 12 <h1 class="header-logo"> <a href="top.html">REI PORT</a></h1> 13 <nav class="header-nav"> 14 <ul> 15 <li><a href="top.html">TOP</a></li> 16 <li><a href="services.html">SERVICES</a></li> 17 <li><a href="skills.html">SKILLS</a></li> 18 <li><a href="works.html">WORKS</a></li> 19 <li><a href="about.html">ABOUT</a></li> 20 <li><a href="blog.html">BLOG</a></li> 21 <li><a href="contact.html">CONTACT</a></li> 22 </ul> 23 </nav> 24 <!-- <img src="img/menu.png" alt="" class="hamburger"> --> 25 </header> 26 27 <main> 28 <div id="eyecatch"> 29 <p>Welcome to REI PORT</p> 30 </div> 31 </main> 32 33 <footer class="footer"> 34 <p>Ⓒ2020 Reiya Kurita</p> 35 </footer> 36 </div> 37 38</body> 39</html> 40
html
1<!DOCTYPE html> 2<html lang="en"> 3<head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <title>Rei port</title> 7 <link rel="stylesheet" href="style.css"> 8</head> 9<body> 10 <div id = "wrapper"> 11 <header class="top-header"> 12 <h1 class="header-logo"> <a href="top.html">REI PORT</a></h1> 13 <nav class="header-nav"> 14 <ul> 15 <li><a href="top.html">TOP</a></li> 16 <li><a href="services.html">SERVICES</a></li> 17 <li><a href="skills.html">SKILLS</a></li> 18 <li><a href="works.html">WORKS</a></li> 19 <li><a href="about.html">ABOUT</a></li> 20 <li><a href="blog.html">BLOG</a></li> 21 <li><a href="contact.html">CONTACT</a></li> 22 </ul> 23 </nav> 24 </header> 25 26 <main> 27 <div id="third"> 28 29 <section id="skills-first"> 30 <div class="skills"> 31 <section class="skills-one"> 32 <svg viewBox="0 0 128 128"> 33 34 </svg> 35 <h4>HTML</h4> 36 <p>★★★☆☆</p> 37 </section> 38 39 <section class="skills-one"> 40 <svg viewBox="0 0 128 128"> 41 42 </svg> 43 <h4>CSS</h4> 44 <p>★★★☆☆</p> 45 </section> 46 47 <section class="skills-one"> 48 <svg viewBox="0 0 128 128"> 49 50 </svg> 51 <h4>JavaScript</h4> 52 <p>★★☆☆☆</p> 53 </section> 54 55 <section class="skills-one"> 56 <svg viewBox="0 0 128 128"> 57 58 </svg> 59 <h4>WordPress</h4> 60 <p>★☆☆☆☆</p> 61 </section> 62 </div> 63 </section> 64 65 <section id="skills-second"> 66 <div class="skills"> 67 <section class="skills-one"> 68 <svg viewBox="0 0 128 128"> 69 70 </svg> 71 <h4>PHP</h4> 72 <p>☆☆☆☆☆</p> 73 </section> 74 75 <section class="skills-one"> 76 <svg viewBox="0 0 128 128"> 77 78 </svg> 79 <h4>jQuery</h4> 80 <p>☆☆☆☆☆</p> 81 </section> 82 83 <section class="skills-one"> 84 <svg viewBox="0 0 128 128"> 85 86 </svg> 87 <h4>Rails</h4> 88 <p>★☆☆☆☆</p> 89 </section> 90 91 <section class="skills-one"> 92 <svg viewBox="0 0 128 128"> 93 94 </svg> 95 <h4>Python</h4> 96 <p>☆☆☆☆☆</p> 97 </section> 98 </div> 99 </section> 100 </div> 101 </main> 102 103 <footer class="footer"> 104 <p>Ⓒ2020 Reiya Kurita</p> 105 </footer> 106 107 108 </div> 109 110</body> 111</html>
css
1 2@charset "UTF-8"; 3 4 5/*------------------------*/ 6/* 全体のスタイル */ 7/*------------------------*/ 8body{ 9 color: #555; 10 margin: 0; 11 padding: 0; 12} 13 14#wrapper { 15 position: relative; 16} 17 18a{ 19 text-decoration: none; 20 color: inherit; 21} 22main { 23 padding-bottom: 80px; 24} 25 26/*------------------------*/ 27/* main */ 28/*------------------------*/ 29 30 31/*------------------------*/ 32/* header */ 33/*------------------------*/ 34 35 36.top-header{ 37 display: flex; 38 justify-content: flex-end; 39 line-height: 60px; 40 height: 10%; 41 align-items: center; 42 background: rgba(0,0,0,0.8); 43 color: aliceblue; 44 position: fixed; 45 margin: 0; 46 width: 100%; 47 48} 49 50.header-logo{ 51 height: auto; 52 width: 20%; 53 font-size: 22px; 54 font-weight: bold; 55 margin-left: 35px; 56 margin-right: 3%; 57} 58 59.header-nav{ 60 display:block; 61 /* width: 100%; */ 62} 63 64.header-nav li{ 65 display: inline-block; 66 margin-right: 1px; 67 font-size: 14px; 68 width: 120px; 69 height: 10%; 70 text-align: center; 71} 72 73 74.header-nav a{ 75 transition: 1s; 76} 77 78.header-nav a:hover{ 79 color: rgb(32, 190, 227); 80 transition: 0.5s; 81} 82 83.hamburger{ 84 width:30px; 85 height:30px; 86 display: none; 87 cursor: pointer; 88} 89 90#eyecatch{ 91 height: 731px; 92 background: url(./img/island.jpg) no-repeat; 93 background-size: cover; 94 background-position: 50% 50%; 95 display: flex; 96 justify-content: center; 97 align-items: center; 98} 99 100#eyecatch p{ 101 font-size: 40px; 102 font-style: italic; 103 font-weight: bold; 104 color: rgb(227, 31, 31); 105} 106 107/*------------------------*/ 108/* services */ 109/*------------------------*/ 110 111#second { 112 background: url(./img/bamboo.jpg) no-repeat; 113 background-size: cover; 114 height: 700px; 115} 116 117/*------------------------*/ 118/* services */ 119/*------------------------*/ 120 121 122/* skills */ 123 124#third { 125 background: url(./img/washitu.jpg) no-repeat; 126 background-size: cover; 127 height: 700px; 128} 129 130#skills-first { 131 padding-top: 90px; 132} 133 134.top-title-center{ 135 font-size: 30px; 136 font-weight: bold; 137 text-align: center; 138 margin-top: 20px; 139 margin-bottom: 0; 140 } 141 142.japanese { 143 text-align: center; 144 margin-top: 0; 145} 146 147.skills { 148 display: flex; 149 justify-content: center; 150 text-align: center; 151} 152 153.skills-one { 154 width: 220px; 155 height: 280px; 156 background-color: rgba(240, 248, 255, 0.7); 157 padding: 20px 35px 50px; 158 box-sizing: border-box; 159 box-shadow: 3px 3px 10px; 160 margin-right: 50px; 161} 162 163 .skills-one:last-child{ 164 margin-right: 0; 165 } 166 167 .skills-one svg{ 168 width: 100px; 169 height: auto; 170 } 171 .skills-one p { 172 padding-top: 10%; 173 } 174 175 #skills-second { 176 margin-top: 40px; 177 } 178 179 /* skills */ 180 181 /* footer */ 182 183 .footer{ 184 height: 80px; 185 text-align: center; 186 line-height: 80px; 187 background: rgba(0,0,0,0.8); 188 color: aliceblue; 189 width: 100%; 190 position: absolute; 191 bottom: 0; 192 } 193 194 195 .footer p { 196 font-size: 14px; 197 padding-bottom: 0; 198 line-height: 80px; 199 margin-top: 0; 200 } 201 202 /* footer */ 203 204 205
回答6件
あなたの回答
tips
プレビュー