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

前端 未结 22 1571
长发绾君心
长发绾君心 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 05:29

    Think that you're reading Arabii or Hebrew: read from the top of the page, right to left to the bottom. ;P The good thing about this "rule" is that it works for the 3 value version too: top right-and-left bottom

    Actually, i allso thought it was hard to remember, but as soon as I discovered it was the direction of the clock it was easier.

提交回复
热议问题