Saturday, June 4, 2011

How to use CSS (CSS using techniques)?

We have already discussed in the last post about one technique using CSS i.e Inline Styles.
Today, We'll discuss some other CSS (Cascading Style Sheets) using techniques i.e Embedded Styles and External Style Sheets.


(2) Embedded Styles
In this technique, we define CSS within Head Tag of an HTML document (Web page). The block of CSS will look like this:

<head>
<style type="text/css">
.
.
.
</style>
</head>


Here Style Tag is new tag that is used to define CSS block within page. It describes all the rules and patterns related to presentation(look & feel) of the page. We define CSS using Selectors



<head>
<style type="text/css">
h1{ color:red; font-size:18px; font-family:Arial }
h3{ color:green; font-size:14px; font-family:Arial }
p { color:blue; font-size:12px; font-family:Arial }
</style>
</head>


This technique is actually use to to make formatting of all Selector with same style. It mean, every h1 will follow same pattern as defined in Style tag. here h1, h3, p will be called as Selector.

Code Example and output is attached:


No comments:

Post a Comment