CSS is used to style web pages. It was developed to seperate code from design.
CSS stands for Cascading Style Sheet. It is a style sheet containing set of instructions which tell a browser how to draw a particular element on a page. CSS controls the appearance of website by creating style sheets. CSS is used to give the same look and feel to the site. In CSS class attribute is used to apply styles on the web pages. Moreover the properties like font, color, size, margin etc. are applied for giving a better look and appearance to the page. Cascading Style Sheet can be of three types: 1. Inline Cascading Style Sheet. 2. Internal Cascading Style sheet. 3. External Cascading Style Sheet.
In Inline Style Sheet particular style is given to a particular line of text. For example if there is need to apply style on a paragraph then in this case Inline Style Sheet can be applied on that particular paragraph.
In Internal Style Sheet the style sheet element can be embedded in the HTML page. i.e style is applied within the particular page.
In External Style Sheet the style is applied on particular page externally. i.e the style is imported to the page from a separate CSS file. External style sheet is the best way of applying style in a particular web page. It removes the complexity of a web page and makes it simple to apply style.
World Wide Web consortium provides a validation service which validates external CSS document to ensure that they conform to the World Wide Web CSS Recommendation. Like HTML, CSS validation ensures that Style Sheets are syntactically correct. The validator provides the option of either entering the CSS documents contents into a text area or uploading a CSS document. The Inline Style Sheet allows a CSS document to declare style for an individual element by using style attribute in element’s starting tag. Each CSS property is followed by a colon and the value of the attribute. For applying color the color name or hexadecimal codes may be used as the value. Style applied in a style element attribute type specifies the MIME type of the style sheet. The Style Sheet uses text/css. Style class declarations are preceded by a period and are applied to elements of the specific class. The CSS rules in Style Sheet use the same format as Inline styles. The property is followed by a colon (:) and values of properties are separated by semicolons(;). The background color attribute specifies the background color of the element. The class attribute applies a style class to an element. The text indent property indents the first line of text in the element by the specified amount. The font style property allows the developer to set text to non italic or oblique. Span is a generic grouping element. It does not apply any inherent formatting to its contents. The dimension of element is applied by the properties height and width. The Cascade of Cascading Style Sheet means that more than one style sheet can be attached to a document and all of them can influence the presentation. For example a designer can have a global style Sheet for the whole site, but a local one for say, controlling the link color and background of specific page.
By taking the appearance markup out of the HTML file developers can decrease the HTML file size and significantly decreases the download time of that file.
By using CSS pages can be made more accessible. By separating the style from the content and structure developers make the pages more accessible.
By separating the CSS page from the content page developers reduce the time of updating the page. It is much easier and faster to update a page that uses styles over using tags. Using CSS one can decide how heading should appear and enter that information once. Multiple style Sheets Cascade into one: Style sheets allow style information to be specific in many ways. Styles can be specified inside a single HTML element inside the element of an HTML page or in an external CSS file. Even multiple External Style Sheet can be referenced inside a single HTML document.