CSS stands for Cascading Style Sheet. CSS allows you to specify various style properties for a given HTML element such as colors, backgrounds, fonts etc.
Before You Begin:
Before you begin studying CSS, you should have a basic understanding of the following:
- Basic word processing using any text editor.
- Developing simple Web Pages using HTML or XHTML.
If you are new to HTML and XHTML then we suggest you to go through the HTML Tutorial.
What is CSS
CSS is the key presentational technology that is used in website design.
Prior to CSS, nearly all of the presentational attributes of HTML documents were contained within the HTML markup; all font colors, background styles, element alignments, borders and sizes had to be explicitly described, within the HTML.
As a result of, development of large web sites, where fonts and color information were repeatedly added to every single page, became a long and expensive process.
CSS solve these problems, by allowing web designers to move much of that formatting information to a separate style sheet resulting in considerably simpler HTML markup.
Note:All the modern web browsers support all of CSS Level 1 and Level 2, and some aspects of newly introduced CSS Level 3 i.e. CSS3.
Origin of CSS
HTML was originally designed as a simple way of presenting information intended for sharing scientific documents and research papers online.
Later on, as the Internet expanded from the academic and research world into the mainstream, and became more media oriented, the presentation of the web pages has become considerably important for a website's success.
To improve web presentation capabilities CSS was introduced by World Wide Web consortium's (W3C). It was intended to allow web designers to define the look and feel of their web pages, and to separate content from document's layout.
Advantages of Using CSS
The biggest advantage of CSS is that it allows separating content of an html document from the style and layout of that document. It can thus make documents much easier to maintain and give much better control over the layout of your web pages, because content of an entire set of HTML pages can be easily controlled using one or more style sheets.
Here are some more advantages, why one should opt for designing website using CSS?
- CSS Save lots of time — CSS gives lots of flexibility to set the properties of an element. You can write CSS once; and then the same code can be applied to the groups of HTML elements, and can also be reused in multiple HTML pages.
- Easy maintenance — CSS provide an easy means to update document formatting and maintain consistency across multiple documents. By making one change to the website's CSS, elements in all the web pages will be updated automatically.
- Pages load faster — CSS enable multiple pages to share formatting, and reduce complexity and repetition in the structural content. It significantly reduces the file transfer size, which results in a faster page loading.
- Superior styles to HTML — CSS has much wider presentation capabilities than HTML, so you can give far better look to your HTML pages in comparison to the HTML presentational elements and attributes.
- Multiple Device Compatibility — CSS can also allow the HTML document to be optimized for more than one type of device or media. Using CSS the same HTML document can be presented in different viewing styles for different rendering devices such as computer screen, cell phones, printer, etc.
Tip:Now most of the HTML attributes are being deprecated and it's not recommended to use. So it's a good idea to start using CSS, to increase your website's adaptability and make them compatible to future browsers.