bootstrap4 のsticky-footerというフッターを下部に固定できるサンプルを利用しています。
sticky-footerのソースをそのまま利用すれば問題なく動作するのですが、フッターの中を上下二層(上層を住所などの情報、下層をコピーライト)に分けたところ、下層の部分が画面サイズを縮小すると上にあがってきてしまいます。
html
1<footer class="footer"> 2 <div class="footer-top"> 3 <div class="container"> 4 <div class="row"> 5 <div class="col-md-4"> 6 フッタートップ1 7 </div><!-- .col-md-4 --> 8 <div class="col-md-4"> 9 <p>フッタートップ2</p> 10 <address>アドレス1行目<br /> 11 アドレス1行目<br /> 12 アドレス1行目<br /> 13 アドレス1行目<br /> 14 アドレス1行目<br /> 15 アドレス1行目<br /> 16 アドレス1行目</address> 17 </div><!-- .col-md-4 --> 18 <div class="col-md-4"> 19 <p>フッタートップ2</p> 20 <address>アドレス1行目<br /> 21 アドレス1行目<br /> 22 アドレス1行目<br /> 23 アドレス1行目<br /> 24 アドレス1行目<br /> 25 アドレス1行目<br /> 26 アドレス1行目</address> 27 </div><!-- .col-md-4 --> 28 </div><!-- .row --> 29</div><!-- .container --> 30</div><!-- .footer-top --> 31 32<div class="footer-bottom"> 33<span>コピーライト</span> 34</div> 35</footer>
css
1html { 2 position: relative; 3 min-height: 100%; 4 } 5body { 6 margin-bottom: 280px; 7 } 8.footer { 9 position: absolute; 10 bottom: 0; 11 width: 100%; 12 height: 280px; 13 background-color: skyblue; 14 } 15 16.footer-bottom{ 17 position: absolute; 18 background-color:gray; 19 bottom: 0; 20 width: 100%; 21 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/03 12:15
2018/03/06 06:51