Padding and margins

can anyone help me in using padding and margins efficiently.
i am getting confused in using them

First thing that came to my mind, even though there are some exceptions:

  • Use margins to control/push/pull block elements
  • Use paddings to control/push/pull inline elements

Second thing that came to my mind, try using margins unidirectionally i.e. either margin-bottom or margin-top for your elements, when it’s impossible to do but clearly needed - go to the first thing and that’s your exception for using padding for block elements :wink: Why? Because this:

1 Like

Some links


1 Like