Home >Web Front-end >CSS Tutorial >How to make main content div fill screen height using CSS and HTML

How to make main content div fill screen height using CSS and HTML

PHPz
PHPzforward
2023-09-06 23:53:021188browse

How to make main content div fill screen height using CSS and HTML

position attribute specifies the type of positioning method used for the element (static, relative, absolute, fixed, or sticky).

In the example given below, the height is not specified as a percentage and jQuery is not required

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

The above is the detailed content of How to make main content div fill screen height using CSS and HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete