Cascading Style Sheet- ‘Styling your Web Pages’
CSS- What is it?
A very important part of website designing is working on its presentation. CSS is kind of a language to define its semantics and enhance the way it looks. It is way to ensure the modular structure of the application, keeping it loosely coupled, yet highly cohesive. This result in comparatively simpler and sorted structure of the web content and keeping its presentation attributes in a separate file. The developer can now write the html (or any markup language) code without having to worry about the layout and design. To sum it up it allows you to take a full control over the look and feel of the web page which is written in a markup language
A little bit of a History
Until 2000, CSS did not gain much popularity among the developers because of the not so easy to understand syntax, the people were apprehensive about using it. Also, the CSS specifications used to different for varying browsers and refrained the web designers from using it. Listed below are the versions of CSS that have come into existence:
CSS 1: The specification of CSS is maintained by W3 consortium. The first version was introduced in December 1996. It supported customization of attributes of the font properties, setting color and background of the text along with other features like character and line spacing. It could also align the images, text and tabular structures. Setting the absolute position of the entity, setting its margins or padding, giving it borders. CSS1 is now obsolete and is no longer recommended by W3C.
CSS2: In May 1998, the next level CSS was introduced by W3C. CSS2 was a super set of CSS1, supporting some additional features. It included setting the relative position of the elements, z-index, new properties corresponding to font, setting attributes for media types. CSS 2.1 was a revised version, with fixed errors of CSS2. Only IE8 can support its full specifications.
CSS3: The first draft was released in June 1999. Unlike the previous versions of CSS, the latest version, CSS3 is a set of modularized documents, each one is referred to as a ‘module’ which is not only stable and backward compatible, but also extends the features specified in CSS2. It is very rich in features and is absolutely delightful for the designers to work on it.
CSS4: Right now, it is still being worked upon. At present, there is no browser which supports it. The web developers are enthusiastically waiting for it.
The CSS syntax comprises two things - Selector: which specifies the element to be styled.
Declaration: Setting the property of the element with an appropriate value. The declarative part is enclosed within parenthesis and can contain multiple declarations each separated by a comma and ending with a semi colon. A comment body in a CSS file is written insides /*…..*/ block
CSS code can also be embedded within the HTML document, but this practice is generally not recommended as it does not solve the purpose of keeping the content separate from the semantics.