+ 1

How is it possible? 🤔 (Margin-top problem)

I set margin:0; in the body and I didn't set any margin at anywhere then aslo it shows margin from top... How is it possible https://code.sololearn.com/Wi28zvET2QsF/?ref=app

18th Dec 2022, 2:48 PM
Pooja Sahoo
Pooja Sahoo - avatar
4 ответов
+ 1
Yes Mr.</CODER> you are correct... Padding of h2 create that space, when I change that to span, it would not gave that space.... By the way Thanks a lot 😇. I learnt a different things from you. Thanks for your help.
18th Dec 2022, 3:23 PM
Pooja Sahoo
Pooja Sahoo - avatar
0
Change body to * in css The margin and padding reset only applied to the body This means the children (header and section element) of the body still had the default margin set by the browser The browser has default settings so it's advised to calibrate the settings before you proceed with your code
19th Dec 2022, 12:12 PM
Kondwani Bwenzi Ng'ombe
Kondwani Bwenzi Ng'ombe - avatar
0
You could also set padding:0 instead of margin:0... Padding is how big the "invisible borders (I call them)" are. If you dont set it to 0, it's still going to offset everything. I usually don't even call margin:0 because most of it can be fixed with padding:0 You should check your paddings with each element that might be causing this. You could use line-height: .5 on the text elements if you want to get more granular with it.
19th Dec 2022, 5:50 PM
Lucius Domitius
Lucius Domitius - avatar