Joined June 2011
·
Posted to
Some things are !important;
over 1 year
ago
Most things are not !important.
Recommended reading: http://coding.smashingmagazine.com/2010/11/02/the-important-css-declaration-how-and-when-to-use-it/
In general, I try to minimize !important
use to general states only, e.g. .hidden
which should override normal rules.
Posted to
DO NOT $('#foo a'); DO $('#foo').find('a');
over 1 year
ago
The difference in actual runtime performance here is so tiny, I doubt if it matters in any real-world use case (who on earth matches millions of selectors, not to mention in a loop over time?).
Just use what's more readable and makes sense in your context. If you nailed the big stuff, tweaked the medium issues and ran out of micro-optimizations, come back to this tip.
Achievements
49 Karma
9,907 Total ProTip Views
Forked
Have a project valued enough to be forked by someone else
Cub
Have at least one original jQuery or Prototype open source repo
Charity
Fork and commit to someone's open source project in need
Nice. What about vertical alignment? Adding simliar
top
properties doesn't seem to work.