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
Share on other sites

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

 

 

top, right, bottom, left (clockwise) is the order in which to specify them

 

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

i just wanna double confirm..

Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.