I believe it is a very basic knowledge but I’m struggling to understand how it works. I would like to know if there is such thing as default margins when you create divs. I’m doing exercise number 16 about margins and paddings but can’t understand how the blocks starts with a top and bottom margin of 22.178 if theres no margin properties on the code.
I believe there is no default margins on divs.
I don’t understand your description, really. Where is the 22.178 margin?
In the challenge, the red and blue boxes have 20px of margin applied to them; the yellow box has none, and looking at the layout of the box model on the right side, there is 0 margin.
’*’ is a universal selector that affects all elements. This will override any default margins to zero pixels. It is useful because you have control over the margins, rather than the browser adding its own default values.