Wednesday, 25 June 2014

CSS(Cascading style sheets) Introduction


To Learn CSS we need some understanding of the HTML/XHTML.

WHAT IS CSS ?
  • CSS stands for CASCADING STYLE SHEETS
  • CSS is introduced in HTML 4.0 to avoid the STYLE problem which comes during the coding of the web sites.
WHAT IS PROBLEM WITH HTML3.2?
  • When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a Complexion for web developers. Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process.
  • To solve this problem, the World Wide Web Consortium (W3C) created CSS.
  • In HTML 4.0, all formatting could be removed from the HTML document, and stored in a separate CSS file.
  • Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file. 
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<style>
body {
    background-color: #d0e4fe;
}

h1 {
    color: red;
    text-align: center;
}

p {
    font-family: "Times New Roman";
    font-size: 20px;
}
</style>
</head>
<body>

<h1>My First  Example</h1>
<p>This is a paragraph.</p>

</body>
</html>

In above example we decide the background color of the page , color & text alignment for h1 &
paragraph writing style for as well as the font size.

we need to save this coding in  .CSS extension.


0 comments:

Post a Comment