PrepAway - Latest Free Exam Questions & Answers

which order should you use the five style sheets?

You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets. The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets? (To answer, move the style sheet types from the list of style
sheet types to the answer area and arrange them in the correct order.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:

See http://www.w3.org/TR/CSS21/cascade.html#cascading-order
To find the value for an element/property combination, user agents must apply the following sorting order:
1. Find all declarations that apply to the element and property in question, for the target media type.
Declarations apply if the associated selector matchesthe element in question and the target medium
matches the media list on all @media rules containing the declaration and on all links on the path through
which the style sheet was reached.
2. Sort according to importance (normal or important) and origin (author, user, or user agent). In ascending
order of precedence:
user agent declarations
user normal declarations
author normal declarations
author important declarations
user important declarations
3. Sort rules with the same importance and origin by specificityof selector: more specific selectors will override
more general ones. Pseudo-elements and pseudo-classes are counted as normal elements and classes,
respectively.
4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter
specified wins. Declarations in imported style sheets are considered to be before any declarations in the style
sheet itself.
Apart from the “!important” setting on individual declarations, this strategy gives author’s style sheets higher
weight than those of the reader. User agents must give the user the ability to turn off the influence of specific
author style sheets, e.g., through a pull-down menu. Conformance to UAAG 1.0 checkpoint 4.14 satisfiesthis
condition [UAAG10].


Leave a Reply