Thursday, 28 November 2013

CSS: Syntax

CSS: Syntax


CSS has two main parts: a selector, and one or more declarations:











The selector is the HTML element you want to style, and each declaration contains a property and a value. The property is the style attribute you want to change. Each property has a value.
For completely knowledge You have to know how to use class and id.

» EXAMPLE:



<html>
<head>
<style>
p { color: orange; font-size: 20px;}
h1 {color: red; font-size: 30px; text-align: center;}
<style>
</head>
<body>

<p>This is simple paragraph</p>
<h1>This is simple heading</h1>

</body>
</html>

» Result:


This is simple paragraph

This is simple heading