iT邦幫忙

0

css- 高度浮動滿版

Zaku 2019-01-23 15:07:111057 瀏覽

假定分成a,b,c三個區塊,body為最外層,隨視窗變化height:100%,可能要靠js抓高度改,a與c為頭尾,固定某一高度,b能浮動撐開剩餘的高度?如果只有一個b用js抓去分配還好,但要是多很多區塊感覺不是太好的方式。像三個區塊計算大概是b=全高-a-b;,一直去算這個感覺不是太好的方式?

 <style>
  body{
      height:100%; //可能要靠js爭測高度
       margin: 0px;
   }
   .a{
       width:100%;
       height: 40px;
       background-color: aquamarine;
   }
   .b{
       background-color: rgb(255, 127, 127);
   }
   .c{
       width:100%;
       height: 40px;
       background-color: rgb(255, 127, 212);
   }
  <style>
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答