Set - 3

Question 16 :

What is CLASS selector?

Answer :

Class selector is a "stand alone" class to which a specific style is declared. Using the CLASS attribute the declared style can then be associated with any HTML element. The class selectors are created by a period followed by the class's name. The name can contain characters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code, however, they cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters).It is a good practice to name classes according to their function than their appearance.

.footnote {font: 70%} /* class as selector */

<ADDRESS CLASS=footnote/>This element is associated with the CLASS footnote</ADDRESS>
<P CLASS=footnote>And so is this</P>


Question 17 :

What is CSS declaration?

Answer :

CSS declaration is style attached to a specific selector. It consists of two parts; property which is equivalent of HTML attribute, e.g. text-indent: and value which is equivalent of HTML value, e.g. 10pt. NOTE: properties are always ended with a colon.


Question 18 :

What is 'important' declaration? 

Answer :

Important declaration is a declaration with increased weight. Declaration with increased weight will override declarations with normal weight. If both reader's and author's style sheet contain statements with important declarations the author's declaration will override the reader's.

BODY {background: white ! important; color: black}

In the example above the background property has increased weight while the color property has normal.


Question 19 :

What is cascade?

Answer :

Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector. 

Declarations with increased weight take precedence over declaration with normal weight:

P {color: white ! important} /* increased weight */
P (color: black} /* normal weight */


Question 20 :

How do I have a non-tiling (non-repeating) background image?

Answer :

With CSS, you can use the background-repeat property. The background repeat can be included in the shorthand background property, as in this example:

body {
    background: white url(example.gif) no-repeat ;
    color: black ;
}