Cascading Style Sheets
HTML 5 along with CSS and JavaScript forms an integrated instrument. CSS is basically a language that works along with HTML to provide visual styles to the elements of the document, such as size, color, backgrounds, borders, and so on.
A style sheet is a collection of rules that specifies the appearance of data in an HTML document. HTML is a markup language that focuses only on the layout of the content on a Web page. However, applying layouts to more than one occurrence of an HTML element in an HTML page is a tedious job.
For example, if you want to change the text in the H2 element to bold, this has to be done manually for all the H2 elements. Such a manual task might result into human errors such as missing an occurrence of the H2 element for applying the bold format. This results in format inconsistency among the H2 elements within an HTML page. Further, the specified formats might not have same appearance across various devices such as computers and mobiles.
A style sheet is a collection of rules that specifies the appearance of data in an HTML document. HTML is a markup language that focuses only on the layout of the content on a Web page. However, applying layouts to more than one occurrence of an HTML element in an HTML page is a tedious job.
For example, if you want to change the text in the H2 element to bold, this has to be done manually for all the H2 elements. Such a manual task might result into human errors such as missing an occurrence of the H2 element for applying the bold format. This results in format inconsistency among the H2 elements within an HTML page. Further, the specified formats might not have same appearance across various devices such as computers and mobiles.
A CSS is a rule-based language, which specifies the formats instructions for the content
specified in an HTML page. Its purpose is to separate HTML content from its formats so that Web page designers would not worry about the formats and layout. This is because
they can define the layout and formats of the content in a separate fie saved with an extension of .css. In the .css fie, the formats instructions for an element are referred to as a rule set. Each rule defies how the content specified within an element should be displayed in a Web browser.
While displaying the HTML page, the browser identifies the .css fie for the page and applies the rules for the specified elements. You can merge the rules from different .css files or can edit them. This task of combining and matching rules from different files is referred to as cascading.
No comments: