Webmasters Heaven, Free submission, Free Promotion, Free Tools
Backword Forward Home add this page to favoirates send this page to a friend print this page icons articles Webmaster Tools Web Site Submit
sitemap
Free Icons Free Articels Free Tools Website submission

Articles Category  ]

Google
 
Advertising
Affiliates
Blogs
CGI
CSS
DHTML
Domain Names
ECommerce
Email
HTML
Internet
Javascript
Link Popularity
Marketing
MLM
Newsletters
Promotion
RSS
Search Engines
Site Security
Traffic Analysis
Web Hosting
Web Design
Webmasters


articles -> css
Article Title Author
Tables vs CSS - Which is better? Mike
CSS; Weight loss for your code Sasch Mayer
HasLayout concept explained - Learn how to exploit IE's layout" Lighezan Alexandru
How to make backgrounds for myspace? Brett Hull
Creating Pretty Buttons Scott Alexander
Fluidity and Text Sizing Nicole Hernandez
What is CSS? Devendra Jaiswal
Your New Website is Inside Drew Stauffer
Equal Heights Three Column Layout With CSS Rizky
CSS Design for change Dean Cruddace
How To Style Your Text With CSS  Hilco van der Meer
Cascading Stylesheets Advantages: 5 Reasons To Use CSS Hilco van der Meer
Creating Tableless Sites - Why and Some Basics Nicole Hernandez
CSS Cursors - How To Use Them Nicole Hernandez
How to create a Myspace layout? Anthony Stillmann
CSS Link Specificity Nicole Hernandez
The Concept Behind CSS Jose Valdez
The 30 minute CSS tutorial. Shabda Raaj
CSS or Tables? Shabda Raaj
Using CSS with Tables Stephen Cope
Cross Browser Compatibility Warren Baker
The Power of CSS Cliff Ritter
Cascading Stylesheets: 5 Reasons To Use CSS Hilco van der Meer
CSS Browser Detection - The complete guide Afonso Ferreira Gomes
CSS in Flash the return of crisp and legible fonts David Collado
Font Organizers Review, Part I David D. Deprice
7 Reasons Why Using CSS is a Must Michael Turner
SEO Benefits Of CSS Steve Chittenden
Starting Cascading Style Sheets stephen cope
Teach yourself CSS the easy way Erich Bihlman
CSS Print Media Tutorial Karl Regis
Using CCS to Eliminate Tables Sanjay Johari
CSS - Maximum benefits Zoran Makrevski
CSS: The Basics - ID's and Classes ... Correct Eric McArdle
CSS: The Basics - ID's and Classes Eric McArdle
Introduction To Cascading Style Sheets Mitchell Harper

The 30 minute CSS tutorial.   by Shabda Raaj


What is CSS?

CSS is the technology used to make the layout for webpages. They are Cascading Style Sheets, used to style your HTML documents. They are slowly replacing tables as the preferred medium to layout your pages. They free your content (the HTML document) from the layout (the CSS file), so you may change your website look and feel easily.

CSS basics.
With HTML, you would define the attributes as you write the HTML. With CSS, you first define the style. Then as you are writing the HTML, you apply the required style. So the first step to write CSS document is defining your styles. There are two ways to apply your CSS to your file. You may either include it in your HTML file by placing your stylesheet in head of your HTML as,

...
<head> <style type="text/css"> Your stylesheet here. </style> </head>
, The Selectors.
After you write your style, the computer needs to know where to apply that style. This can be done using the selectors. The selectors are of three types. 1. HTML tag selector: If you want to change the look of any of your html tags, you will use this type of selector. You may decide that all of your h2 elements must have red text. It is trivially easy with CSS. 2. Class selector: you would like particular parts of your webpage to have a style, but that part is not always in same html tag. Not to worry, you can enclose that part with a div tag and apply your style. 3. ID selectors: If some element occurs only once it is styled using id selectors.

Your First Stylesheet.
With your first stylesheet, you will modify the page to look yellow with a blue foreground.
<html> <head> <title>Page title</title> <style type="text/css"> body{ background-color:yellow; color:blue; }

</style> </head> <body> some text </body> </html>
The HTML part is simple, so let's look at the CSS part. body{ background-color:yellow; color:blue; }
We wanted to modify the body so we used the body tag selector. This basically said to the computer that this style needs to be applied to whole body of html document. Then we used the background-color property to set the background and the color property to set the foreground. What if you wanted to set all the text to bold? Oh that's simple too, you just add this line inside the body selector. font-weight: bold;

Getting something useful.
The last css though simple was not very useful. Let us design a useful CSS which might be used on a site. Before that you must learn positioning elements using CSS. We would like to have a three column layout. So I will use three selectors(Id selectors) named sidebar, content and rightsidebar. Theses lines of codes declare our selectors. #sidebar #content #rightsidebar. Then we will tell how these should look like. I want my sidebar and rightsidebar to have aqua colored background. This is done using background: Aqua;
Next we add borders to all our selectors and add a top margin of 20 pixels. We would like the contents to be bolder, so we add font-weight: bold; to content. After that we decide to spice up our links by making them of a different color and removing the underlines, by getting a color:#c60; text-decoration:none; To give the user a visual indication of the link when she moves her mouse, we swap the link colors. This is done by changing the style in a:hover.

So this is what our finished page looks like.
<html><head><title>Preview</title> <style type="text/css"> #sidebar{ background: Aqua; width:100px; border-width: 1px; margin: 20px 0px; border-style: dotted; float:left; } #content{ font-weight: bold; width:400px; border-width: 1px; margin: 20px 0; border-style: dotted; float:left; } #rightsidebar{ background: Aqua; width:100px; border-width: 1px; margin: 20px 0px; border-style: dotted; float:left; } a:link { color:#c60; text-decoration:none; } a:hover{ font-weight: bold; background: #c60; color:White; text-decoration:none; } </style> </head> <body> <div id="sidebar">sidebar</div> <div id="content">content a link
</div> <div id="rightsidebar">rightsidebar
</div> </body></html>
, What! Do I have to learn all these tags and attributes?
No. But you must remember the more important ones. Also the attributes have very common sense names. What should you do to change the background color of your webpage. Yeah this.

body{ background:Aqua; }
, That's all. SO if you are going to use CSS for any length of time, you will get to remember the tags. A css editor like TopStyle lite can be really useful when you are learning css.
, Thats all for today. Hope you learnt something useful from this tutorial.

About the Author

Shabda Raaj is a free lance web designer and an avid blogger. His web design tutorials can be found here..


[Advertisement ]