Making a CSS Document

Making a CSS document is simplicity itself. A CSS document is nothing but a plain text (ASCII) file, saved with the ".css" file name extension; remember to follow all of the regular naming rules for any file name on the Web (NO SPACES IN THE NAME!).

Example CSS Document Names:

myStyles.css
styleSheet.css
michaelStyles.css

The content for a CSS document usually follows this format:

  1. Place a comment at the beginning of the code, indicating your name and contact information, and what this CSS document is being used for; this information will allow other programmers (who are presumably working with you, or who are in your company) to contact you with questions about your work, and to figure out what project this CSS document applies to.
  2. Follow the comment with all of your CSS declarations.
  3. If necessary, add comments between your CSS declarations, indicating what they are for.

Example:

/*
Style Sheet for Widget Website
Michael Masumoto -- michael@michaelmasumoto.com
*/

/* Begin General Site Styles */

p { color:#000000; font-size:14pt; }
b { font-weight:bold; }

/* End General Site Styles */

/* Begin Home Page Styles */
etc...

Remember: there are NO HTML tags in a CSS document. CSS IS NOT HTML! There is no HEAD, no BODY, no TITLE, no HTML tag, no HTML of any kind! A CSS document is linked to an HTML page using a special tag on the HTML page itself, not on the CSS document; we'll talk about the specifics of this linking process in a later section. In a CSS document, you are just defining the way HTML is going to look; you're not actually using HTML.

Main Menu