Tuesday, September 24, 2013

CSS stylesheet elements review
Class is a selector. You could use class from a stylesheet directly in the controls within the HTML body. All elements with that class can then be defined in the stylesheet as .classname  { color : green } Only one class can be specified per selector
 ID is also a selector and can be used for unique elements such as a particular paragraph element.
The style sheets can be more than one and can be combined so that the individual sections are modular. Hence the term cascading style sheets. Both the author and the reader can influence the presentation through the stylesheets using the same language.
Conflicts between different stylesheets are resolved as follows:
1) Find all declarations that apply to the element or property. If there is no declaration, an inherited value is used.
2) Sort the declarations by explicit weight such as with the marking important.
Weights of individual declarations can be improved with the notation important.
3) Sort by origin : the author's style sheets override the reader's style sheet
4) Sort by specificity of selector - more specific selectors will override more general ones. For example, id attributes is applied over class.
5) Sort by order specified, use the latter specified in the order.

 

No comments:

Post a Comment