Home | Site Map | Submit Article
.
Article Search
 
Article Categories

Advice

Auto Motive

Business

Communications

Computers & Internet

Dating

Education

Employment

Entertainment

Environment

Family

Fashion

Finance

Food & Drink

Gardening

Health

Hobbies

Home Business

Home Improvement

Humor

Kids & Teen

Legal

Marketing

Music

Online Business

Parenting

Pets

Product Reviews

Real Estate

Recreation & Sports

Self Improvement

Site Promotion

Technology

Travel & Leisure

Web Development

Women

World Affairs

Writing

 
   
   Introduction to CSS (Cascading Style Sheets)


18 Feb 2008 04:38:05
| Erthy W


A Cascading Style Sheet is a set of rules that specify how a HTML document should be presented.

Cascading Style Sheets are used to format HTML. You should have at least a basic understanding of HTML before starting to learn CSS.

There are three types of style sheet: external, internal, and inline. Cascading Style Sheets get their name from the hierarchy assigned to them. The inline style sheet has the highest priority when formatting the HTML, followed by the internal style sheet, and finally the external style sheet. This means that if there are conflicting values in an inline style sheet and an external style sheet for example, only the style defined within the inline style sheet will be applied (the rest of the external style sheet will be applied as normal however).

The only major difference between style sheets is their location in relation to the document. Inline style sheets are contained within the specific element's tags, and will be only be applied to that element. Internal style sheets are included between the head tags of the document, and will only be applied to the elements within that specific document. External style sheets are separate .css documents that are applied to elements in pages that they are linked to. This makes them very useful for applying the same style to different documents. The link to the external style sheet is included in the head tags.

The CSS structure is comprised of 3 components: the selector, the property and the value. The selector defines which HTML element is being formatted. The property defines what aspect of the HTML element needs to be changed. The value specifies how the aspect will be changed.

The selector is defined first, followed by the property and the value contained between curly braces and separated by a colon, like so: Selector{property:value}

For example, if we wanted to define a 2 pixel border for all the tables in a document:

Table{border-width:2px}

Note: the word "attribute" is often used instead of "property".

The structure is slightly different for inline style sheets, as they are specific to the element in which they are contained; there is no need for the selector or the curly braces. If we wanted to define a 2 pixel border for one specific table, the tag would look like this

(An apostrophe has been included after the starting tag to avoid being recognized as HTML).

Once you know the structure of CSS, all you need to know is the different selectors, properties and values. You define your own selectors using classes and IDs. An ID is unique and can only be used once in a document, whereas you can classify any number of elements in a document using classes. Remember not to start the name of your ID or class by a number as this not supported by some browsers. There is also a 'wildcard' selector: the asterisk *.

If you are interested in learning more about CSS, there are many good resources online.



About Author :

Webmaster of Ertharnia.com
Home >> Web Development

More Related Articles in " Web Development "
>>
Review on QuarkXpress 6.0 [ Author : Mart Gil Abareta ]
>>
Logo Designs on the Go [ Author : Kristine Llabres ]
>>
Small Business Website Design - How to Get Professional Results [ Author : Michael Turner ]
>>
Your Country Needs You [ Author : malcolm james pugh ]
>>
THERE’S MORE TO CREATING WEB SITES THAT MEETS THE EYE [ Author : Jinky C. Mesias ]
>>
DesignSmarts [ Author : Colin Eyo ]
>>
Cheap and inexpensive hosting service - choosing the right one for your needs [ Author : Oliver Turner ]
>>
Types of Web Hosts [ Author : Akhil Shahani ]
>>
How to create a great website [ Author : Patrick Tan ]
>>
Ten Very Effective Ways Of Using Your Autoresponder [ Author : Dan Brown ]
 

 
© Copyright 2005-2007 Free Articles by articleburn.com All rights reserved
eXTReMe Tracker