Sunday, 18 September 2011

css : Avoid Superfluous Selectors

Sometimes your CSS declaration can be simpler, meaning if you find yourself coding the following:
  • ul li { ... }
  • ol li { ... }
  • table tr td { ... }

They can be shorten down to just
  • li { ... }
  • td { ... }
Explanation:
li will only exist within ul or ol
and td will only be inside
tr and tableso there’s really not necessary to re-insert them.

No comments:

Post a Comment