Have 2 questions to ask regarding css styling not working;
-
You can see from the codepen above that yadadada heading is placed with no margin as * selector has property margin equal to 0. But when I use those exact code and open up the html file in the google chrome browser, the yadadada has a margin-top space even though it’s supposed to be 0. I tried “inspect” by right clicking and I see that margin:0; is crossed out. Why is this?
-
So I tried adding margin-top:0; to h1 selector and the the top space disappeared with everything working perfectly. Why does this happen? I’ve already declared margin to be 0 from * selector so why does it need me to declare again that h1 is 0?
-
Continuing from the 2nd question, why doesn’t it work if set div as margin-top:0; even though it works when I set h1 as margin-top:0;?
thank you!