How do you set the body to the full size of the screen in html and css?


The body in my code is a little off of the left and top of the screen, I tried removing content-box and removing margin, but it isn’t working. I also tried absolutely positioning it left:0; and top:0; but none of that works, here is my code;

body {
    padding: none;
    margin: none;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
    width:100%;
    height: 100vh;
    border: 2px solid red;
}

Source: CSS – Stack Overflow

November 30, 2021
Category : News
Tags: css | html

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.