The two rules shown previously have the following result: If you define a property value twice, browsers render your web element depending on each rule??™s position in the cascade. See the section ???The cascade??? later in the chapter for more information. THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN 14 The p rule colors the web page??™s paragraphs black. The #navigation p rule overrides the p rule for paragraphs within the navigation div, coloring them blue and making them bold. By working with contextual selectors, it??™s possible to get very specific with regard to styling things on your website; we??™ll be using these selectors regularly. Adding styles to a web page The most common (and useful) method of applying CSS rules to a web page is by using external style sheets. CSS rules are defined in a text document, which is saved with the file suffix .css. This document is attached to an HTML document in one of two ways, both of which require the addition of HTML elements to the head section. The first method of attaching a CSS file is to use a link tag: ?‚ media="screen" /> Alternatively, import the style sheet into the style element:
The second of these methods was initially used to ???hide??? CSS rules from noncompliant browsers, thereby at least giving users of such devices access to the website??™s content, if not its design.