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

前端 未结 22 1514
长发绾君心
长发绾君心 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

    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.

    0 讨论(0)
  • 2021-01-30 05:30

    "Top,Right,Bottom,Left"
    Really
    Bad
    Limerick

    0 讨论(0)
  • 2021-01-30 05:30

    If you're old enough to remember the original Star Trek TV series (you know, with Capt Kirk), well first of all, you're too damn old. But there is "The Trouble with Tribbles" episode. Both nouns in the title work. I've used that in the past, but also prefer the clock analogy.

    0 讨论(0)
  • 2021-01-30 05:32

    The Really Big Lebowski

    0 讨论(0)
  • 2021-01-30 05:32

    TROUBLE is always a secondary reminder for me, since I first think of the clockwise direction but might need to remember where you start; however, the 3-value shorthand was always confusing me until I realized the middle, (or second) value needs to represent two values (the sides). So, three values - the 2nd being 2 values - helps me remember that.

    0 讨论(0)
  • 2021-01-30 05:33

    Another attempt:

    Tyrannosaurus Rex : Big Lizard

    0 讨论(0)
提交回复
热议问题