-1

I've a blank angular app, with only an AppComponent. I edited the styles to remove padding & margin, but I keep getting the body(check by setting a background-color to it) that has some kind of margin in the top.

Here is a running example: https://stackblitz.com/edit/angular-ivy-44yyz1?file=src/styles.css

Why the red background doesn't start on the top?

seems like a stupid question(probably is) but with the inspector and everything, I cannot see what is the issue.

J4N
  • 19,480
  • 39
  • 187
  • 340

1 Answers1

0

The problem is that the H1 element has a margin by default.

You can just remove it:

h1 {
   margin: 0px;
}
Caio Oliveira
  • 526
  • 4
  • 10
  • 1
    `h1 { margin-top: 0; }` – Simon K Mar 10 '22 at 20:36
  • That's it, but I'm not sure to understand, why a margin on the h1 affect the body? Because the margin should be between the h1 and the div, then the div& body should have the correct(red) color from the top of the page, no? – J4N Mar 11 '22 at 06:14