海量收录 · 12,310+ 源码 / 模板 / 插件 / 教程,付款后立即下载 开通会员享折扣| 我的订单| 客服 QQ 923457156
前端开发教程

如何使用CSS和HTML使主要内容div填充屏幕高度

2025-01-14 35 次浏览 免费资源

position 属性指定用于元素的定位方法的类型(静态、相对、绝对、固定或粘性)。

在下面给出的示例中,没有以百分比形式指定高度,也不需要 jQuery

.mainbody{  
   position: absolute;//here we are setting the position of an element as absolute
   top: 30px; /* here we are defining Header Height to 30 px */
   bottom: 10px; /*here we are defining  Footer Height to 10 px */
   width: 100%;// here we are setting the width to 100%
}

以上就是如何使用CSS和HTML使主要内容div填充屏幕高度的详细内容,更多请关注双恒网络其它相关文章!

免费下载无需付费,点击即可获取
去下载