codespot.com
Home News About Join Us Contact

KNOW ABOUT:
Programming C HTML Javascript CSS Java


css 3: Cascading Style Sheet

css3


Introduction:

CSS is used to control the style of a web document in a simple and easy way. CSS is the acronym for "Cascading Style Sheet". This tutorial covers both the versions CSS1,CSS2 and CSS3, and gives a complete understanding of CSS, starting from its basics to advanced concepts.CSS is a widely used language on the web.
HTML, CSS and JavaScript are used for web designing. It helps the web designers to apply style on HTML tags.


CSS Rules

CSS Rules are the styles that we have to create in order to create style sheets. These rules define appearance of associated HTML element. The general form of CSS syntax is as follows:
Selector {property: value;}

Key Points:
Selector is HTML element to which CSS rule is applied.
Property specifies the attribute that you want to change corresponding to the selector.
Property can take specified value.
Property and Value are separated by a colon (:).
Each declaration is separated by semi colon (;).


Embedding CSS into HTML

Following are the four methods to add CSS to HTML documents.

1) Inline Style Sheets
2) Embedded Style Sheets
3) External Style Sheets
4) Imported Style Sheets


External style sheets

External Style Sheets are the separate .css files that contain the CSS rules. These files can be linked to any HTML documents using tag with rel attribute.
Syntax:
<head> <link rel= “stylesheet” type=”text/css” href= “url of css file”> </head>


In order to create external css and link it to HTML document, follow the following steps:


First of all create a CSS file and define all CSS rules for several HTML elements. Let’s name this file as external.css.
p{ Color: orange; text-align: left; font-size: 10pt; } h1{ Color: orange; font-weight: bold; } *Now create HTML document and name it as externaldemo.html.


References:


Video Tutorial: