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

PHPz
Release: 2023-09-06 23:53:02
forward
1146 people have browsed it

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%
}
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template