How can I memorize all CSS shorthands?

后端 未结 5 998
渐次进展
渐次进展 2021-02-09 18:33

I never forgot and always use shorthand for margin and padding because it runs clockwise, but how do you remember the others?

Do you use CSS sh

相关标签:
5条回答
  • 2021-02-09 19:13

    I personally am not good at memorizing such things, so I use the specific attributes, background-position background-image background-repeat etc. instead of the shorthand.

    I find it's less error prone, and makes for more maintainable code: You can search & replace specific settings project-wide, which is impossible when using shorthand.

    0 讨论(0)
  • 2021-02-09 19:17

    Here’s a decent CSS shorthand cheat sheet (PDF).

    0 讨论(0)
  • 2021-02-09 19:20

    Use an editor that understands the shorthand syntax and gives you some degree of auto complete on them. I too don't need one that tells me margin goes top, right, bottom, left, but it is useful to have one that tells me the options for background for example.

    Visual Studio does this - it won't be the right choice for everyone obviously, but if Visual Studio does it I'm sure there must be many others that do too.

    0 讨论(0)
  • 2021-02-09 19:23
    • ctrl+T for new tab
    • ctrl+K for Google search bar
    • "css font shorthand" and done!
    0 讨论(0)
  • 2021-02-09 19:36

    I've previously had only the difficulty to remember the order to declare the a pseudoselectors link, visited, hover and active (it actually matters!). Here I use the LoVe HAte mnemonic for.

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