overflowはhiddenとscroll両方つけることができますか?
#outは一番外の枠です。この中に要素が入っています。
outからはみ出てしまったx軸の要素をoverflow: hidden;で隠しつつ
y軸要素はoverflow: scroll;をつけたいです。
html
1<!-- out --> 2 <div id="out"> 3 4------------省略------------ 5 6 </div>
css
1#out{ 2 width: 100vw; 3 overflow: hidden scroll; 4 scroll-snap-type: y mandatory; 5 height: 100vh; 6 position: relative; 7}
現在、このように書いてありますが、iphoneで実機確認をするとoutの外に白いスペースが出現します。
-----------追記-----------
↓↓↓↓↓下にスクロール↓↓↓↓↓↓
こちらが実際の実機画面(横)です。
このように外側に白いスペースが出来てしまいます。
-----------更に追記-----------
html
1<body> 2 3 <!-- out --> 4 <div id="out"> 5 <div style="white-space: nowrap;"> 6 7 <!-- scroll area --> 8 <section class="area"> 9 10 <!-- header --> 11 <div id="header"> 12 13 <div id="sisi-box"> 14 <img src="img/sisi.png" alt="唐獅子" id="sisi"> 15 </div> 16 17 <div id="swirl-box"> 18 <img src="img/ swirl.png" alt="" id="swirl1"> 19 <img src="img/ swirl.png" alt="" id="swirl2"> 20 <img src="img/ swirl.png" alt="" id="swirl3"> 21 <img src="img/ swirl.png" alt="" id="swirl4"> 22 <img src="img/ swirl.png" alt="" id="swirl5"> 23 <img src="img/ swirl.png" alt="" id="swirl6"> 24 </div> 25 26 <ul id="nav-box"> 27 <a href="#window" id="work"><li>WORK</li></a> 28 <a href="#window" id="profile"><li>PROFILE</li></a> 29 <a href="#window" id="contact"><li>CONTACT</li></a> 30 </ul> 31 32 <div id="lant-box"> 33 <a href=""><img src="img/lantern.png" alt="" id="lant"></a> 34 </div> 35 36 </div> 37 38 </section> 39 40 <!-- middle --> 41 <div id="middle"> 42 43 <div id="gl-box"> 44 <img src="img/patern.png" alt="金の帯" id="gl-band"> 45 </div> 46 47 <div id="rm-box"> 48 <img src="img/ranma.png" alt="" id="ranma"> 49 </div> 50 </div> 51 52 <!-- scroll area --> 53 <section class="area"> 54 55 <!-- window --> 56 <div id="window"> 57 58 <div class="content"> 59 <div id="room-box"> 60 61 <!-- magatama --> 62 <div id="mt-box"> 63 <img src="img/magatama.png" usemap="#ImageMap" alt="" id="mt"/> 64 <map name="ImageMap"> 65 <area href="javascript:b();" class="mt-green" shape="poly" coords="114,34,127,27,146,24,161,25,177,28,193,33,216,45,231,57,246,71,257,90,268,115,274,135,275,150,275,161,274,171,273,179,267,166,264,156,258,147,252,140,242,132,236,128,215,121,197,122,188,125,174,128,152,136,141,136,130,133,124,132,117,129,109,122,101,111,94,99,92,85,92,76,94,66,99,52,106,43,110,38,114,36,114,36" alt="緑" /> 66 <area href="javascript:b();" class="mt-yellow" shape="poly" coords="63,245,68,249,73,253,83,259,95,265,110,270,122,273,138,276,152,277,161,277,173,275,184,273,202,267,214,260,225,253,232,245,243,237,249,230,257,217,261,210,266,196,268,185,265,168,262,159,257,152,252,146,240,137,230,132,216,129,203,128,195,130,186,132,176,138,171,142,167,148,162,154,159,161,156,170,154,181,152,189,149,199,147,206,144,214,141,221,133,230,128,234,120,239,112,243,99,247,92,247,81,247,74,246,69,246,64,244,83,247" alt="黄色" /> 67 <area href="javascript:a();" class="mt-red" shape="poly" coords="106,34,98,35,91,38,85,41,79,45,75,48,69,53,63,57,61,59,57,62,52,71,47,76,45,78,36,92,34,101,32,104,28,116,25,125,24,136,22,149,23,160,24,167,25,177,27,184,28,189,32,201,37,211,40,216,44,224,48,227,54,232,61,236,67,238,78,241,90,242,102,241,109,238,114,235,119,232,123,229,126,226,132,221,136,215,141,207,144,198,144,192,146,187,144,176,145,203,146,184,143,170,139,164,137,159,130,149,123,142,119,140,111,132,108,129,105,125,96,117,92,109,89,99,87,86,89,70,90,63,92,58,93,54,96,49,98,44,101,41,104,36,104,36" alt="赤" /> 68 </map> 69 </div> 70 71 <!-- door --> 72 <div class="left"> 73 <div> 74 <p class="fadeIn">Home</p> 75 </div> 76 </div> 77 <div class="right"></div> 78 </div> 79 </div> 80 81 </div> 82 83 </section> 84 85 </div> 86 </div> 87 88<script src="javascript/jquery.js"></script> 89 90</body>
css
1body{ 2 width: 100vw; 3 line-height: 0; 4 background-color: rgb(214 150 43); 5} 6*:focus { 7 outline: none; 8} 9#out{ 10 margin: 0; 11 width: 100vw; 12 overflow: hidden scroll; 13 scroll-snap-type: y mandatory; 14 height: 100vh; 15 position: relative; 16} 17::-webkit-scrollbar{ 18 display:none; 19} 20/* scroll auto */ 21.area { 22 scroll-snap-align: start; 23 height: 100vh; 24 transition: scroll-snap-align 10s; 25} 26/*---------- head ----------*/ 27 28/*---------- middle ----------*/ 29 30/*---------- window ----------*/ 31
css中身は省略していますが、だいたいこういう状態です。
outの中にhead,middle,windowが入っています。
回答4件
あなたの回答
tips
プレビュー