Share this Page URL

Getting Your Own Domain Name > Registering a Domain Name - Pg. 249

250 Learn HTML 4 In a Weekend Anatomy of a Style Rule A style is also called a style rule. A style sheet is composed of one or more style rules. A style rule is composed of two parts--a selector and a decla- ration block. For example: selector { declaration block } A selector designates an element or elements ( h1 , for example) to which style properties are to be declared. It can be a simple selector (specifying a single element) or it can be any of a number of more complex or spe- cialized selectors. You learn more about using these other kinds of selec- tors later in this session. A declaration block is separated from the selector by curly braces and can contain one or more declarations, separated by semicolons. For instance: selector { declaration1; declaration2; declaration3; } A declaration is composed of two parts: a property name and a value, sep- arated by a colon (color: blue , for example) . For example: selector { property1: value; property2: value; property3: value; } Using Inline Styles The STYLE attribute lets you apply style properties directly to an element. This kind of style is generally referred to as an inline style. Inline styles generally take precedence over any other styles that are applied to an element. For example: <h1 style="style rule"> Linking and Importing External Style Sheets There are two additional ways to include style sheets in documents: linking and importing. The LINK element can be used in the HEAD element to link to an external style sheet. The @import at-rule (from CSS2) can be used to import style rules into an embedded style sheet.