HEMANT SONKER'S BLOG

Monday, August 25, 2008

CSS

What does CSS basically mean??

CSS mean Cascading Style Sheet.

Style sheets are a very powerful tool for the Web site developer. They give you the chance to be completely consistent with the look and feel of your pages, while giving you much more control over the layout and design than straight HTML ever did.


Style rules are comprised of two things, the selector and the declaration.

selector - The HTML tag that will be affected by the rule

declaration - The specific style calls that will affect the selector.

In CSS, selectors are used to declare which elements a style applies to, a kind of match expression. Selectors may apply to all elements of a specific type, or only those elements which match a certain attribute; elements may be matched depending on how they are placed relative to each other in the markup code.

In addition to these, a set of pseudo-classes can be used to define further behavior.The best-known of these is :hover, which applies a style only when the user 'points to' the visible element, usually by holding the mouse cursor over it. It is appended to a selector as in a:hover or #elementid:hover. Other pseudo-classes and pseudo-elements are, for example, :first-line, :visited or :before.

A declaration-block consists of a list of semicolon-separated declarations in braces. Each declaration itself consists of a property, a colon (:), a value, then a semi-colon (;).

But the question is what does cascading mean in CSS.??

Cascading is something that makes CSS even more powerful. Style sheets cascade when The Web Writer or user (or both) have created an order of precedence for the browser to apply the style rules in multiple sheets. The style rule or sheet that has the highest precedence is the one that is used. The following list is a simplification of how your browser decides precedence for a style:

  1. Look for the style element that is created, if it is not in the document, use the default rules in the browser.
  2. Determine if any of the style rules are marked as important and apply those to the appropriate elements.
  3. Any style rules in the document will have precedence over the default browser settings.
  4. The more specific the style rule, the higher the precedence it will have.
  5. Finally, if two rules apply to the same element, the one that was loaded last will have the highest precedence.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home