CSS Make A Div Full Screen

Raja Tamil
1 min readAug 17, 2020

There are multiple ways we can make a div take up the whole screen horizontally and vertically.

I have a simple div element with a class name box.

<div class="box">
</div>

Then, clear any default margin or padding from the HTML and body tags.

html, body {
margin:0px;
}

height:100%

Before setting height property to 100% inside .box class, make sure to add it to both HTML and body tags as well, otherwise, it won’t work.

--

--

Raja Tamil

👇click the link and get 80% OFF on the premium web development courses (HTML5, CSS3, JavaScript ES6, Vue JS 3 & Firebase 10 https://softauthor.com