Is there any difference between
margin: 0;
and
margin: 0em;
I didn't notice anything, but my teacher keeps telling me that it's not the same.
0 and 0em are the same, but any value other than 0 for x and xem are not the same. Follow this answer to receive notifications.
The px belongs to the absolute category of length units whereas the em and %(percentage) refers to the relative class of sizing units. The value of px is fixed over the HTML document but the em and %(percentage) depends on the unit used by the parent element.
The file is bigger with 0em.
The way to prove to your professor that there is no difference is to set something to 0 and something else to 0em and inspect the DOM with Firebug or a similar tool. If I recall correctly, you'll see that both are now 0. So the only difference is in the source. (But it's been a while since I checked. I might be thinking of getting and setting styles from jQuery. So check it out before you take my word.)
There's no difference when the value is 0. If it were 1 and 1em, yes, there's a difference, but 0 is 0, no matter the unit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With