Web site optimization - CHAPTER 5 DISPLAYING XML USING CSS 123

CHAPTER 5 DISPLAYING XML USING CSS 123 example, I ve set the color property, which sets the foreground or text color of the heading. The value of the property is #2B57A1, a blue color. The rule ends with a semicolon. Tip A CSS declaration can consist of several property-value pairs, and each property-value pair within a rule must be separated with a semicolon. If you forget the semicolon, property-value pairs that appear afterwards will be ignored. While you don t have to add a semicolon at the end of a single declaration, it s good practice in case you want to add more declarations afterwards. CSS supports a system of inheritance. Once you declare a rule for an element, it applies to all child elements as well. If you set a rule specifying the color for the , all child elements will inherit that color, including

,

,

, and

elements. The exception here is links, which a web browser often overrides. You may have to include a separate rule for the element. This is one of the reasons for the name cascading stylesheets. The CSS declarations flow down the element tree. Another reason for the name is that you can use rules from several stylesheets by importing one into another or importing multiple stylesheets into the same XHTML file. In addition, the rules apply in a cascading order. An inline declaration overrides a declaration embedded in the section of a page, which overrides an external stylesheet. The following example shows a single rule containing multiple declarations. This means that the rule applies to several elements at the same time: h1, h2, h3 {color:# 2B57A1; font-family:Verdana, Arial, sans-serif; font-weight:bold;} Commas separate the element names in the selector: h1, h2, h3 Here, semicolons separate several properties for these elements, and all properties appear between curly braces: {color:# 2B57A1; font-family:Verdana, Arial, sans-serif; font-weight:bold;} If you want the

element to appear in italics as well, you can add an additional rule: h3 {font-style:italic;} By declaring the common properties together, you can avoid repeating all the other property-value pairs when declaring the

element individually. Rules declared individually have a higher level of precedence in the cascade. For example, if you add a font-weight:normal declaration in the rule for

, it will override the bold declaration in the preceding rule. You can find a list of CSS2 properties at http://www.w3.org/TR/REC-CSS2/propidx.html. Many web sites explain how these properties are applied within stylesheets.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check
mysql web server services.

Leave a Reply