0

Here is my HTML code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./style.css">
</head>
<body>
    <header>
        <div>KK</div>
    </header>
</body>
</html>

Here is the css code:

html{
    margin: 0;
    font-size: 20px;
}
div{
    margin: 0;
    padding: 0;
}
header{
    background-color: cornsilk;
    width: 100%;
    padding: 0;
    margin: 0;

}

I used zero padding and zero margin everywhere as I heard that header by default has indentations. But nothing seems to work( thank you for your answers in advance!!

enter image description here

m4n0
  • 29,823
  • 27
  • 76
  • 89

3 Answers3

2

Problem was solved by adding to the css code

body{margin:0}
0

Your <body> has a default margin of 8 pixels. just add to the CSS code:

body{
    margin: 0;
}
Ethan.S
  • 385
  • 3
  • 13
0

Even better would be:

* {
  margin: 0;
  padding: 0;
}
Daweed
  • 1,419
  • 1
  • 9
  • 24