A mnemonic for the order of CSS margin and padding shorthand properties

前端 未结 22 1528
长发绾君心
长发绾君心 2021-01-30 05:20

I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is:

margin-top:    2px;
margin-bottom: 4px;
m         


        
22条回答
  •  再見小時候
    2021-01-30 05:29

    Just think clockwise, it's the easiest way. Starts at the top and goes around... much easier to remember than some silly phrase (provided you know how to read a clock...)

提交回复
热议问题