You are on page 1of 2

CSS Introduction

<p><b>Cascading Style Sheet </b>(CSS) is a presentation defination


language that is used to control the layout of <b>HTML</b> documents by
attaching CSS, you can apply styles such as color of text, set margins, style
of fonts, background images, spacing between paragraphs and words and
much more</p>
<p><b>CSS</b> was developed by <b>World Wide Web Consortium</b>
(W3C) in 1997 and is supported by all the web browsers.</p>

<h2>Advantages of CSS</h2>
<hr>
<ul type=disc>
<li><b>Load Web Pages Faster:</b> If you are using <b>CSS,</b> you
don't need to write code of HTML tag attributes every time. Just write one
CSS rule of a tag and use anywhere within your program. So less code means
faster download times. </li>
<li><p><b>CSS Saves Our Time:</b></li>You can write CSS once and
then reuse same style sheet in multiple HTML pages. You can define a style
for each HTML element and apply it to as many Web pages as you want.</p>
<li><b>CSS is Easy to Maintain :</b> CSS is easy to maintain because if
you want to change the style globally then, simply change the CSS style
sheet, and all elements in all the web pages will be updated automatically.
</li>
</ul>
<h2>CSS Syntax or CSS Rules:</h2>
<hr>
In order to create a style sheet, we have to specify a set of rules known as
CSS rules or Styles. These rules are used to control the appearance of
various elements that appear in the associated HTML documents. The
general syntax for specifying the rule is:

<p style="background-color:#99FF99;border:1px dashed


#FF00FF;">Selector { Property : Value; }

A <b>selector</b> is an element to which each CSS rule is applied. It may


be a HTML tag name (without a starting and a closing brace), class or ID
attributes.
<b>Property</b> specifies the attribute that you want to change
corresponding to a selector. The value that the property can take is specified
by <b>Value</b>. The <b>Property</b> and <b>Value</b> are separated
by a colon ( : ) and enclosed in curly braces. Each property value pair is
known as <b>declaration</b>. If multiple declarations exists then each
declaration must be separated by a semicolon ( ; ). The semicolon tells the
browser where a declaration ends and other begins. Some examples of CSS
rules are given below:
<pre lang=HTML>
1. p { color : red;}
2. h1 { color : green; font-style : italic }
3. body
{
color : ##99FF99;
font-family : Arial;
font-size : 16pt;
}
</pre>

You might also like