CSS:让元素充满页面

让元素充满页面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

相关文章
相关标签/搜索