Cascade and Rule Declarations

From Got Opinion Wiki
Jump to navigation Jump to search


Styles passing from higher to lower hierarchy levels.

Cascade Rules

Cascade Rules p57:

  1. Find all declarations that apply to each element and property
  2. Sort by order and weight
  3. Sort by specificity
  4. Sort by order

Weight of declaration

Define a rule as important using the exclamation point. Marking a tag as important will override the cascade.

p {color:red !important; font-size:12pt;}

Rule Declarations

Declarations are made up of a property and value.


p {color:red;}

color = property and red = value

Values fall into three main types:

  1. Words
  2. Numerical values
  3. Color values

Numerical values

Use to decribe the "distance" or height, width, depth, length, etc. for many values. p61

Two main groups of numerical values:

  1. Absolute
  2. Relative

Absolute value describes a real distance. Relative value compared to another.

Absolute value chart:

Absolute Value Unit Abbreviation
Inches in
Centimeters cm
Millimeters mm
Points pt
Picas pc
Pixels px

Relative value chart:

Relative Value Unit Abbreviation Note
Em em Width of character in a font.
Ex ex Equivalent to the x-height of the given font.
Percentage %

Color Values

Hexadecimal format


Percentages format

R%, G%, B% 
Back to Cascade Style Sheets