Chovy’s Blog

The “Cascade” Effect in “Cascading Style Sheets”

Fri, July 20, 2007 — Category: UI Design

Explanation of the “C” in “CSS” with specificity…

Of course there are “excuses” for inline CSS style declarations…that’s why we have them.

Are they misused? Of course.

HTML emails need to be constructed with inline styles…for those who have never tried….but alas, that is not why we have ‘em.

We have them to override those “special one-off” cases that do not require a global definition.

Use the “DRY Principle — Don’t Repeat Yourself”

  1. If you need an inline style, use it.
  2. If you re-use it on that page only, put it in the local stylesheet.
  3. If you use it on multiple pages, refactor it into your global css file.

There was no mention of “specificity” — which may be considered part of the cascade.


/* generalized style -- less specific */
ul { background-color: green; font-weight: bold; }

/* overrides more general styles -- but also inherits */
ul#nav.special { background-color: red; }
  • Post The “Cascade” Effect in “Cascading Style Sheets” to del.icio.us
  • Post The “Cascade” Effect in “Cascading Style Sheets” to digg
  • Post The “Cascade” Effect in “Cascading Style Sheets” to Furl
  • Add The “Cascade” Effect in “Cascading Style Sheets” to YahooMyWeb
  • Simpify!
  • Post The “Cascade” Effect in “Cascading Style Sheets” to shadows
  • Post The “Cascade” Effect in “Cascading Style Sheets” to Spurl
  • Post The “Cascade” Effect in “Cascading Style Sheets” to BuddyMarks
  • Submit The “Cascade” Effect in “Cascading Style Sheets” to Slashdot

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

 
Keyword Advertisers:
SEO Directory SEO Links Free Link Directory Shopping Submission Directory Gardening Tips Political Forum Search Engine Optimization Search Engine Marketing Audio Video Directory SEO Forum Web Development Blog Organic SEO Wiki Web Development Consulting

Learn more about purchasing keyword text link ads on this site.