前提・実現したいこと
ウインドウの高さに応じて、背景の長さを変えたいです
ここに質問の内容を詳しく書いてください。
HTMLとCSSで1ページを作っています。
section class="function"の高さを画面に合わせて変動できるようにしたいです。
(レスポンシブ)
発生している問題・エラーメッセージ
500pxと高さを指定している為、
ウインドウの長さを引き延ばすと、背景が途切れてしまいます。
試したこと
%指定すると、footerの位置が崩れてしまいます。
(グレー背景の上に浮かんでる状態)
どうしてもできず質問させて頂きました。
ご教示頂きたいです。どうぞよろしくお願いいたします。
該当のソースコード
HTML
1 <section class="function"> 2 <h1>Function</h1> 3 <div class="function-images clearfix"> 4 <div class="function-image"> 5 <p>機能1</p> 6 </div> 7 <div class="function-image"> 8 <p>機能2</p> 9 </div> 10 <div class="function-image"> 11 <p>機能3</p> 12 </div> 13 <div class="function-image"> 14 <p>機能4</p> 15 </div> 16 </div> 17 </section> 18 <footer> 19 <div class="sentences"> 20 <p>test</p> 21 <p>test</p> 22 </div> 23 </footer> 24
CSS
1html { 2 position: relative; 3 min-height: 100%; 4} 5 6body { 7 text-align: center; 8 height: 100%; 9} 10 11 12.function { 13 background-color:#BABFC3; 14 font-size: 12px; 15 width: 100%; 16 height: 500px; 17 padding-top:20px; 18 19} 20 21.function-images { 22 display: inline-block; 23} 24 25.function-image { 26 float: left; 27 margin: 0 15px 0; 28 padding: 15px; 29 width: 15%; 30 height: auto; 31} 32 33.clearfix:after { 34 content: ""; 35 display: block; 36 clear: both; 37} 38footer { 39 background-color: #000000; 40 height: 80px; 41 width: 100%; 42 position: absolute; 43 bottom: 0; 44 display: table; 45} 46 47footer .sentences{ 48 display: table-cell; 49 text-align: center; 50 vertical-align: bottom; 51} 52 53footer p { 54 font-size: 12px; 55 line-height: 12px; 56 color: #ffffff; 57} 58
回答2件
あなたの回答
tips
プレビュー