CSS redirects here.

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a web page. While the W3C CSS Working Group has produced dozens of CSS-related specifications (whose most recent version is CSS 4), CSS 2.1 is (after over a dozen years of drafts) still the only entirely reliable basis for styling web pages.

From the CSS 2.1 Recommendation:

This specification defines Cascading Style Sheets, level 2 revision 1 (CSS 2.1). CSS 2.1 is a style sheet language that allows authors and users to attach style (e.g., fonts and spacing) to structured documents (e.g., HTML documents and XML applications). By separating the presentation style of documents from the content of documents, CSS 2.1 simplifies Web authoring and site maintenance.

Example#

A CSS stylesheet is a text (human-readable) document composed from one or more CSS rules. A CSS rule is at its most basic rather simple, composed of a selector and one or more assigned style properties. For example, the following rule styles all HTML paragraphs with a 'class' attribute containing the value "hilight" (i.e., "<p class='hilight'>Outside of a dog...</p>") to having a left margin of 16 pixels and a 'MidnightBlue' font color. Colors in HTML can be specified various ways, either as HTML Colour Names such as "MidnightBlue", RGB ("rgb(25,25,112)") or hexadecimal ("#191970") values. Because only a few color names are reliably supported by all browsers it is safer to use an RGB or hexadecimal value.

p.hilight { margin-left: 16px ; color : #191970 }

where the selector is "p.hilight", the assigned properties of "margin-left: 16px" and "color : #191970".

JSPWiki permits direct input of CSS styles using wiki markup. The above example can be accomplished directly on a wiki page using the following markup:

%%(margin-left: 16px ; color : #191970)
Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. &mdash; Groucho Marx
%%

This would appear as:

Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. — Groucho Marx

Specifications#