Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Cascading Style Sheets


 Contents
1 This will appear in large bold blue italics
2 This will appear in large bold blue italics
Cascading Style Sheets (CSS) is a computer language used to describe the presentation of a structured document written in HTML, XHTML or XML. The CSS specification is maintained by the World Wide Web Consortium (W3C).

1 Overview

CSS is used by both authors and readers of web pages to define colors, fonts, layout, and other aspects of document presentation. It is designed primarily to enable the separation of document structure (written in HTML or a related language) from document presentation (written in CSS). This separation provides a number of benefits, including improved content accessibility, greater flexibility and control in the specification of presentational characteristics, and reduced complexity of the structural content. CSS is also capable of controlling the document's style separately in alternative rendering methods, such as on-screen, in print, by voice (when read out by a speech-based browser or screen reader) and on brailleThere is also an asteroid 9969 Braille Braille is a tactile writing system used by blind people. It was invented by Louis Braille of France who was blinded in a childhood accident. At the age of 15 he modified a military system for reading orders at night-based, tactile devices.

CSS can be used with XML, to allow such structured documents also to be rendered with full stylistic control over their layout, typography, colour etc in any suitable user agentA user agent is the client application used with a particular network protocol; the phrase is most commonly used in reference to those which access the World Wide Web. Web user agents range from web browsers to search engine crawlers ("spiders"), as well or browserA web browser is a software package that enables a user to display and interact with documents hosted by web servers. Popular browsers include Microsoft Internet Explorer and Mozilla Firefox. A browser is the most commonly used kind of user agent. The lar.

Presentational characteristics can be specified by

element name
e.g. for all 'p' or 'h2' elementsThis article is about HTML elements. For information on how to format Wikipedia entries, see How to edit a page and In computing, an HTML element (instance) in terms of SGML is the complete sequence of a start tag (with attributes and their values), any e
relative combinations of elements
e.g. for 'li' elements that are descendants of other 'li' elements (i.e. nested lists)
an element's explicit 'class' or 'id'
e.g. to elements where these attributes have been set either for other structural reasons or purely to help specify presentational style

CSS information can be provided by:

CSS specifies a cascading order that accords relative weights to rules. When rules from the three origins overlap, the one with the greatest weight is actually applied.

Advantages of using CSS include:

CSS has a simple syntax, and uses a number of English keywords to specify the names of various style properties.

A style sheet consists of a list of rules. Each rule consists of a selector and a declaration block. A declaration-block consists of a list of semicolon-separated declarations in curly braces (often an optional semi-colon is put after the last item also, so that between the braces there is a list of declaration/semi-colon combinations). A declaration consists of a property, followed by a colon (:), followed by a value.

Example:

p { font-size: 110%; font-family: garamond, sans-serif; } h2 { color: red; background: white; } .highlight { color: red; background: yellow; font-weight: bold; }

These are three rules, with selectors p, h2, and .highlight. A declaration is e.g. "color: red", with "color" a property and "red" a value.

Here, the HTML elements p (paragraph) and h2 (level two heading) are being assigned stylistic attributes. The paragraph element will be rendered in a font size ten per cent larger than its parent, in the Garamond font or, if Garamond is unavailable, a generic sans-serif font. The level two heading element will be rendered in red, on a white background. The third rule shown here defines a CSS class, which can be assigned to any HTML element by using the class attribute. For example:

This paragraph will be rendered in red and bold, with a yellow background.

Often css code contains comments; the format is

/* comment */



Read more »

Non User