讓元素充滿頁面html
方法1:用固定定位/絕對定位設置上下左右距離爲0(但脫離文檔流;)spa
#s1{htm
background-color: green;
position: fixed;/absolute
left: 0;
right: 0;
top: 0;
bottom: 0;
}文檔
方法2:body是由內容撐開的,寬度和高度的百分比是相對於父級的;it
給body,html的高度和寬度設置爲100%;io
頁面的固定條; 方法
position: fixed;/absolute;
top:0;bottom:0;top