skip to Main Content
* {
    margin: 0;
    padding: 0;
    box-sizing:border-box;
  }

  
  .header {
    min-height: 100vh;
    width: 100%;
    background-color: red;   
  }
  
<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>|
    <link rel="stylesheet" href="style.css" >
</head>

<body>
    <section class="header">

    </section>
</body>
</html>

The body is causing the section element to move down a little bit so

The only solution I found was to use negative value with margin-top

I have tried
setting margin and padding zero to all the padding elements
and every other solution I could think of

2

Answers


  1. Chosen as BEST ANSWER

    I came back after washing my face and found out there was a typo at

     <title>Title</title>|
    

  2. There will be default margin to body by browser I am attaching the link to previously solved stack overflow link Why is there a default margin on the <body> element?

    body {
      margin: 0;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search