Search code examples
cssstylesheetmarginpadding

css margin first or padding first?


In CSS code,

we use

#testing{
margin: 0;
padding: 0;
}

i use RECESS to code qualify my css file

it suggest me to use padding first and margin after

#testing{
padding: 0;
margin: 0;
}

My question is, does the order of padding and margin important in css quality?

And what's the different between padding first and margin first?

EDIT

just wondering why it suggest the order for me

enter image description here


Solution

  • My question is, does the order of padding and margin important in css quality?

    I consider the reason is "coding style".

    In order to readability, consistency, manage, picky...

    You can also order by a-z, type, css3 last...etc.

    And what's the different between padding first and margin first?

    Looks.

    Example:

    WordPress CSS Coding Standards

    Google HTML/CSS Style Guide