How can I memorize all CSS shorthands?
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 shorthand wherever possible?
What are the best ways to remember different shorthands?
Update:
I also found 2 good shorthand Cheat-sheet.
- Png - http://www.catchmyfame.com/wp-conten开发者_开发问答t/uploads/2009/07/CSS-Shorthand-Cheat-Sheet.png
- PDF - http://www.eddiewelker.com/wp-content/uploads/2007/09/csscheatsheet.pdf
Here’s a decent CSS shorthand cheat sheet (PDF).
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.
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.
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.
- ctrl+T for new tab
- ctrl+K for Google search bar
- "css font shorthand" and done!
精彩评论