Styles

Styles - Styles 2:25 PM Styles The purpose of cascading style sheets(CSS is to separate the style of a web page from its content Rules CSS contains

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
5/25/10 2:25 PM Styles Page 1 of 6 http://www-rcf.usc.edu/~trinagre/itp104/lectures/Styles.html Styles The purpose of cascading style sheets (CSS) is to separate the style of a web page from its content. Rules CSS contains simple statements, called rules. Each rule provides the style for a selection of HTML elements. A typical rule consists of a selector along with one or more properties and values. The selector specifies which elements the rule applies to. You can select any element using its name as the selector. By separating element names with commas, you can select multiple elements at once. In each rule, you can set one or more properties. Properties All properties and values in a rule go between {} braces. Each property declaration ends with a semicolon. Many properties are inherited. For instance, if a property that is inherited is set for the <body> element, all the <body> 's child elements will inherit it. You can always override properties that are inherited by creating a more specific rule for the element you'd like to change. Classes We can define a class of elements and then apply styles to any element that belongs to that class. To add an element to a class, just add the attribute class along with the name of the class to the tag in HTML. Example: <p class="bluetext"> To create a selector for the class, add a rule with the name of the selector (element name) with a "." after it and then followed by the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/25/10 2:25 PM Styles Page 2 of 6 http://www-rcf.usc.edu/~trinagre/itp104/lectures/Styles.html class name. Example (in stylesheet): p.bluetext { color: blue; } An element can belong to more than one class by placing multiple class names in the class attribute with spaces between the names. Example (in stylesheet):
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 05/25/2010.

Page1 / 6

Styles - Styles 2:25 PM Styles The purpose of cascading style sheets(CSS is to separate the style of a web page from its content Rules CSS contains

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online