Cascade and Rule Declarations
Jump to navigation
Jump to search
Back to Cascade Style Sheets
Cascade
Styles passing from higher to lower hierarchy levels.
Cascade Rules
Cascade Rules p57:
- Find all declarations that apply to each element and property
- Sort by order and weight
- Sort by specificity
- 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.
Example:
p {color:red;}
color = property and red = value
Values fall into three main types:
- Words
- Numerical values
- 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:
- Absolute
- 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
#RRGGBB
Percentages format
R%, G%, B%