Search code examples
htmlcssheaderborderpadding

how to make a header fit the page limits


I have this simple code:

body {
    padding: 0;
    background-color: red;
    margin: 0;
}

header {
    background-color: blue;
    text-align: center;
  }
<body>
    <header>
        <h2>Vendi su eBay e guadagna extra cash!</h2>
    </header>
</body>

The problem is that the header is still not at the top of the page and every solution I found isn't working, what's wrong?

here is a screenshot


Solution

  • h2 {
     margin: 0;
    }
    

    h2 tag has the default margin so just make it 0.