如何使用 CSS 和 HTML 使主要內容 div 填滿螢幕高度


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%
}

更新於: 04-Mar-2020

363 次瀏覽

開啟您的職業生涯

透過完成該課程獲得認證

開始
廣告
© . All rights reserved.