让元素充满页面
方法1:用固定定位/绝对定位设置上下左右距离为0(但脱离文档流;)
#s1{
background-color: green;
position: fixed;/absolute
left: 0;
right: 0;
top: 0;
bottom: 0;
}
方法2:body是由内容撑开的,宽度和高度的百分比是相对于父级的;
给body,html的高度和宽度设置为100%;
页面的固定条;
position: fixed;/absolute;
top:0;bottom:0;