Stands for Cascading Style Sheets. Language destined to the presentation of documents, Css is an essential ressource of the web ecosystem. Embodying the doctrine of separation of content and presentation of a document, Css allows you to factorize style informations, and by the same way to reduce considerably the weight of a web page.
What is Css ?
The Css selectors
The selectors are one of the great strengths of the Css language. By combining these, it is possible to assign a style to any element.
The next few examples were realized to be used with a XHTML document, which remains to this day the main application of style sheets.
The centering of an element
Historically developped with the paper industry, information relays center nowadays the presentation of their digital data, in order to give to the reader the illusion to be in front of a paper sheet. This effect, which can be seen on this site, can be realized with few lines of code. According that the element <body> is containing the element <div id='container'>, the element <div id='container'> is centered on the browser.
The regular expressions
The regular expression are available in Css. It is possible, by the way of three operators (^=, ~= and *=), to select attributes which matche with the wished predicate.
The style above can, for exemple, used to order visually hypertext links
The sprites
One of the most recurring difficulty during the creation of style sheets is the explosion of the number of used images. Due to maintenance convenience, images are often fragmented. Nevertheless, on an efficient point of view, it is a severe mistake. Indeed, each image downloaded by the browser lead the execution of an Http request, which is generally too important in term of temporal cost, compared to the image weight.
One solution to this matter is the use of sprites. Well know in the gaming universe, sprites are actually a collection of images which are close in terms of dimension and colors. This technic allows you to greatly divide the download time of an image, and improves significantly the user experience. Once the image created, you just have to play with horizontal and vertical offsets in order to obtain the wished part.