100 likes | 110 Views
Cascading Style Sheets. What is a style sheet?. A controlling document (or part of the document) Sets the default appearance of items on the web page. Advantages. Greater control over document look and feel Less key stroking. Disadvantages. Not downwardly compatible
E N D
What is a style sheet? • A controlling document (or part of the document) • Sets the default appearance of items on the web page.
Advantages • Greater control over document look and feel • Less key stroking
Disadvantages • Not downwardly compatible • Not implemented across browsers and platforms evenly.
Three ways to attach a style tag • Inline • <h1 style=“color: blue; font-style: italic”> I am so blue</h1> • Document-level • External style sheets
Style Syntax • Tag-selector {property1:value1; property2:value1, vaue2, value3;…}
Multiple Selectors • H1, H2, H3 {text-align: center} is the same as • H1 {text-align: center}H2 {text-align: center}H3 {text-align: center}
Contextual Selector • OL LI {list-style: upper-alpha}OL OL LI {list-style: upper-roman}OL OL OL LI {list-style: lower-alpha}OL OL OL OL LI {list-style: lower-roman} • Note: no commas used
Classes • Classes are subsets of a style • P.big {font-size: 18pt}P.medium {font-size: 12pt}P.small {font-size: 9pt} • Classes can be defined with out being associated with a tag.
Special Cases • A:link, A:active, A:visited – define the 3 states of the <a> tag. • P:first-lineP:first-letter define 2 states of <p>