PC(mac,win共に)や、fireHDなどのタブレットでは、意図した通りにwebサイトが表示されるのですが、iPadやiPhoneのみ、レイアウトが崩れてしまいます。
色々と調べて試した結果、
<meta name="viewport" content="width=640, user-scalable=yes,">
をhead内に記述することで、概ね改善されたのですが、
① background-imageの画像が縦長に表示されてしまう。
html
1<div class="top-box"> 2 <div class="top-p"> 3 <h1>,,,,,,</h1> 4 </div> 5 </div>
css
1 .top-box{ 2 width: 100vw; 3 height: 100vh; 4 min-height: 100vh; 5 background-image: url(../img/DSC_6871.jpg); 6 background-size: cover; 7 background-position: center; 8 position: relative; 9 font-weight: normal; 10} 11.top-p{ 12 height:100px; 13 width: 90%; 14 margin: auto; 15 position: absolute; 16 top: 0; 17 left: 0; 18 right: 0; 19 bottom: 0; 20 color:white; 21 text-shadow: 2px 2px 1px black; 22 text-align: center; 23}
② background-imageの画像が大きく表示されてしまう
html
1<div class="top-box2"> 2 <div class="space"> 3 4 </div> 5 6 <div id="container"> 7 <div class="container-box"> 8 <h1>,,,</h1> 9 <p>,,,</p> 10 </div> 11 </div> 12 </div> 13
css
1 .top-box2{ 2 position: relative; 3 background-image: url(../img/DSC_2690.jpg); 4 height: 100%; 5 background-attachment: fixed; 6 background-position: center; 7 background-size: cover; 8 background-repeat: no-repeat; 9 } 10
③ ハンバーガーメニューのcolorが反映されない
html
1<header> 2 <h3><a href="index.html">,,,,,</a></h3> 3 <div id="nav_toggle"> 4 <div> 5 <span></span> 6 <span></span> 7 <span></span> 8 </div> 9 </div> 10 <nav> 11 <ul> 12 <li><a href="index2.html">,,</a></li> 13 <li><a href="index3.html">,,,</a></li> 14 <li><a href="index4.html">,,,</a></li> 15 <li><a href="index5.html">,,,</a></li> 16 <li><a href="mailto:">,,,,</a></li> 17 </ul> 18 </nav> 19 </header>
CSS
1header nav ul li a{ 2 display: block; 3 color: black; 4 }
などの不具合が改善されません。ちなみにPCでは全て意図した通りに反映されており、iPhoneなどにのみ不具合が出ております。
こちらの改善方法をご教示お願い致します。
回答2件
あなたの回答
tips
プレビュー