Jump to content

margin curious


zgkhoo

Recommended Posts

margins, padding, borders, etc can be done all in one shot by using statements like:

margin: 1em 0 1em 0;

or the shortened

margin: 1em 0;

 

basically with 2 it is saying top & bottom margins = 1em and left & right margins = 0 (none)

 

if you used all 4 it would be in the order top, left, bottom, and right margins

 

and 1 would set all of them to the same thing

 

hope that helps

Link to comment
https://forums.phpfreaks.com/topic/66480-margin-curious/#findComment-332914
Share on other sites

0 just mean no margin for the left and right.

Note:

margin: 1em 0;

means apply a margin of 1em to the top and bottom and zero for the left and right.

 

When you specify a zero for a value you don't have to provide a unit. You only set a unit for a size when you set a value greater than zero.

Link to comment
https://forums.phpfreaks.com/topic/66480-margin-curious/#findComment-333254
Share on other sites

which 1 is the correct 1? 0 stand for 0em?

i just wanna double confirm..

 

clockwise - top, right, bottom, left is absolutely the right order when all four are specified.

 

0 stands for zero, nothing, so units are not required.  A 'good' practice is to include the units even for zero values.

 

If you read the link I provided ALL will be clear.

Link to comment
https://forums.phpfreaks.com/topic/66480-margin-curious/#findComment-333341
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.