div+css 實現frameset佈局效果,100%高度和寬度 ,全視窗效果

來源:互聯網
上載者:User
title

  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
  • content
footer

解析:
1.一定要將html和body標籤的高度設置為100%,因為子節點的百分比高度/寬度是相對父節點而言的,只有當最根部的節點設置為100%,才能保證下面的子節點高度是100%;
html
{
min-height: 100%;
height: 100%;
}
body
{
margin: 0;
padding: 0; /*min-height: 100%;*/
height: 100%;
}
2.header,content,footer三塊的高度必須全部用百分比,否則其中一個用js獲取高度(視窗高度-其他層的高度之和),其他都用固定高度.只有這樣才能確定每一塊的高度,才能滿屏.

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.