CSS (Cascading Style Sheet)

css

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.

CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts.This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple pages to share formatting, and reduce complexity and repetition in the structural content (such as by allowing for tableless web design). CSS can also allow the same markup page to be presented in different styles for different rendering methods, such as on-screen, in print, by voice (when read out by a speech-based browser or screen reader) and on Braille-based, tactile devices. It can also be used to allow the web page to display differently depending on the screen size or device on which it is being viewed. While the author of a document typically links that document to a CSS style sheet, readers can use a different style sheet, perhaps one on their own computer, to override the one the author has specified.

Syntax :

 || selector { property: value } ||

The selector is the (X)HTML element that you want to style. The property is the actual property title, and the value is the style you apply to that property.

Each selector can have multiple properties, and each property within that selector can have independent values. The property and value are separated with a colon and contained within curly brackets. Multiple properties are separated by a semi colon. Multiple values within a property are separated by commas, and if an individual value contains more than one word you surround it with quotation marks. As shown below.

 body {
 background-color : #000000;
 font-size : 100%;
 padding : 0;
 text-align : center;
 }

Version :

CSS1:

The first CSS specification to become an official W3C Recommendation is CSS level 1, published in December 1996.Among its capabilities are support for

  1. Font properties such as typeface and emphasis
  2. Color of text, backgrounds, and other elements
  3. Text attributes such as spacing between words, letters, and lines of text
  4. Alignment of text, images, tables and other elements
  5. Margin, border, padding, and positioning for most elements
  6. Unique identification and generic classification of groups of attributes

CSS2:

CSS level 2 specification was developed by the W3C and published as a recommendation in May 1998. A superset of CSS 1, CSS 2 includes a number of new capabilities like absolute, relative, and fixed positioning of elements and z-index, the concept of media types, support for aural style sheets and bidirectional text, and new font properties such as shadows.

CSS2.1:

CSS level 2 revision 1, often referred to as “CSS 2.1”, fixes errors in CSS 2, removes poorly supported or not fully interoperable features and adds already-implemented browser extensions to the specification. In order to comply with the W3C Process for standardizing technical specifications, CSS 2.1 went back and forth between Working Draft status and Candidate Recommendation status for many years. CSS 2.1 first became a Candidate Recommendation on February 25, 2004, but it was reverted to a Working Draft on June 13, 2005 for further review. It returned to Candidate Recommendation on 19 July 2007 and then updated twice in 2009. However, since changes and clarifications were made, it again went back to Last Call Working Draft on 7 December 2010.

CSS3:

Unlike CSS 2, which is a large single specification defining various features, CSS 3 is divided into several separate documents called “modules”. Each module adds new capabilities or extends features defined in CSS 2, over preserving backward compatibility. Work on CSS level 3 started around the time of publication of the original CSS 2 recommendation. The earliest CSS 3 drafts were published in June 1999.

CSS4:

There is no such thing as a whole called CSS4, since it is split into separate modules. However, there are “level 4” modules.

Since CSS3 split the CSS language’s definition into modules, the modules have been allowed to level independently. Most modules are level 3 – they build on things from CSS 2.1. A few level 4 modules exist (such as Image Values, Backgrounds & Borders, or Selectors), which build on the functionality of a preceding level 3 module. Others define entirely new functionality, such as Flexbox.

So, while there is no monolithic “CSS4” that will be worked on after “CSS3” is finished completely, the level 4 modules can collectively be referred to as “CSS4”.