For simple to complicated websites, the content within the site can be completely separated from the design of the site. This is important for a couple obvious reasons: you can update content without changing the style, and you can change the style (colors, fonts, layouts) without having to make any changes to the content.
You can make one change to a style sheet, and it will simultaneously change every part of your content that takes its orders from that style sheet. Let's put this into perspective-changing one piece of CSS code, can change the colors, layout, fonts, and more of many, many, many pages all at one time. For a great illustration of this quality taking effect, please visit and read the information on the home page of:
Main Format
Cascading Style Sheets are composed of two main parts: Selector & Declaration.
This is an example of a simple style sheet:
H2 { Font-weight: bold}
The Selector is "H2"
The Declaration is "Font-weight: bold"
If you attach this style sheet to any HTML document, all of the content held between the tags will be bold. There are many different types of declarations and selectors, and you will probably not memorize all of them. Having some kind of online resource, or text reference will help you when you're in the process of creating your site. Also, Dreamweaver will automatically list the selector or declaration items if you type in part of it, Dreamweaver also has some unique visual aids and guides when working with CSS.
Attaching CSS
When you write up all of the style sheets, using the particular selectors (H2, H1, P, etc.) and declarations (font-weight: bold, font-size: 12px, etc) you will then save this document as a CSS file. CSS files contain no head tags, no paragraph tags; basically they are not formatted the way that HTML pages are formatted. Just the styles, that's it.
You save the file will a .css extension, and then proceed to attach it to the HTML documents you want to be affected by it.
You would attach a style sheet as show in red and within the head portion of the HTML:
The code shown in blue is the way in which you would attach a style within the HTML document, and requires no linking whatsoever.
title
HREF="MainStyle.css" TITLE="Cool">
Headline is blue
While the paragraph is blue.
Now, you can probably see why putting a style attribute (declaration on a selector) within the body of the text defeats the purpose and greatness of CSS. It only affects the one piece of text that the style in surrounding.
Selectors
If you are new to CSS, you are probably wondering…What I can use these style sheets on, so far I've only see P and H1… You can style almost any standard HTML selector, some examples include:
H1, H2, P, em
In addition to these selectors, you can actually create selectors yourself, and identify images or content as the selector! The two examples of this are:
ID Selectors have a unique value over all other selector elements. An example of what the CSS code would look like using an ID selector:
#Days { font-family: verdana; color: #ffffff }
There are two ways to specify the ID within the HTML code.
You can identify this ID with another element-
Monday, Tuesday, Wednesday
Or as its own DIV, which is also its own unique element-
Monday, Tuesday, Wednesday
Class Selectors similar to ID selectors, but their formatting is different, and they hold a slightly less importance than ID selectors when it comes time for the HTML to choose the order of the styles.
An example of what the code would look like:
.days {font-family: verdana; color: #ffffff}
There are also two ways to specify the class within the HTML code.
You can identify the class with another element:
Monday, Tuesday, Wednesday
Or as its own DIV, which is a unique element being styled by the class selector
Monday, Tuesday, Wednesday
Here are some resources to help you better understand the many different class selectors and declarations. It is composed of many pages, but it is useful to get a general idea of some of the possibly attributes and selectors that can be made using CSS.
I will continue the CSS Tutorial for Beginners in a "Part 2." Cascading Style Sheets can be very confusing and overwhelming if you are new to them. When I first attempted to teach myself CSS, I spent hours upon hours, days upon days, trying to find resources online that provided me with in depth knowledge on the subject. Hopefully, I can help someone avoid all that trouble.
Published by Nikki Freeman
Freelance Writer, Graphic Designer, Web Designer. My first passion was writing, my second Art, my third singing/songwriting/music/my guitar, fourth technology. Put them all together and somehow they manage t... View profile
- MySpace Layout Tutorial for BeginnersA beginner's guide to using CSS code to create your own MySpace Profile page.
How to Customize Your Mouse Cursor with CSSCascading Style Sheets, or CSS, is a style sheet language used in web development to describe the presentation of structured documents. CSS is used to design and customizing web...- What is CSS?Understanding Cascading Style Sheets for the everyday coder.
- Interesting Facts About The Days of the Week in Spanish Did you think you could learn about the planets by naming the days of the week? well you can! There is a rich history in language that reveals way more than how to say a word.
- Create a Mobile Version of Your Website with CSSCSS, the acronym for Cascading Style Sheets, gives you an easy and quick way to make a mobile version of your website.
- Web Design Tutorial: Creating Simple CSS Rollovers
- Free Online Resources to Learn Basic Hypertext Markup Language or HTML
- Where to Find Premade CSS Codes
- Code to Help You Dress Up Your MySpace Page with Color, Style
- Cascading Style Sheets
- Build Your Home on the Web with Styles Using Cascading Style Sheets
- Holy Monday, Tuesday, and Wednesday: Holy Week in the Orthodox Church
- Attaching a CSS document to your web page
- Adjust one style sheet and change multiple elements within your web page
- Creating your own selectors


1 Comments
Post a CommentThanx for stopping by! Muah!