Webmaster Nook - Directory, Resources & Web Tools
Webmaster Nook
Directory
Webmaster Tools
Webmaster Resources
Contact Us
Featured Website

Your First Style Sheet

CSS Tutorial by Patricia Fason
 

CSS, or Cascading Style Sheets, can make the life of a webmaster much easier. Instead of having to type tags over and over again, you can place instructions in a style sheet and refer to it. External style sheets enable you to change the appearance and layout of all the pages in your Web, just by editing one single CSS document. You will need some knowledge of HTML to understand this tutorial. Lets get started.

Open up your text editor and save it with a name such as style using a css extension (ie style.css). On any page that you are going to want to use this style sheet, add this in the head section of your page. (After your title and meta tags and before /head replacing style.css with whatever name you selected.):

<link rel="stylesheet" type="text/css"
href="style.css" />

Now let's cover the most useful parts that are easy to understand. Instead of putting all of your instructions for the page in a body tag, lets use the style sheet to do it. First we will open it with:

body
{
color: #2E2F4A;
background-color: #FFFFFF;
font-family: Arial, courier, serif;
font-size: 10pt;
}

What we have done is this:

  • color assigns the font color for all of the text on your pages.

  • background-color assigns the background color, in this case, white.

  • font-family is where you assign a font. List them in order of preference because when a browser renders the page, it will use the first one in the list that it can. Your last choice should always be something very common.

  • font-size, of course, specifies what size font you want your text to be.

Be sure to use a semicolon to separate them as shown. Now, instead of having to put all of that information in your body tag on every page, you can simply type <body>.

Next



Home | Directory | Web Tools | Webmaster Resources | Privacy Policy | Contact Us