ThePlace

Home ] Search ] Resources ] Site Map ] Contact Me ]
Dave's Information Technology Resource

Up ] CSS Summary ]

DHTML ] [ CSS ] JavaScript ] ActiveX and Plug-ins ] VBScript ] Web Applications ] ASP ] Web Databases ] ASP Applications ] Perl ] Java ]

--- CSS ---

Cascading style sheets (CSS) enable you to develop web sites that share a common look-and-feel (fonts, headings, colors, backgrounds, etc.).  CSS essentially allows you to define how an HTML tag works--in other words, how it will format content.

CSS...

bulletIs a declarative language that is used to enhance the HTML language.
bulletIs intended to be user friendly; it was purposely designed to be very readable and writable.
bulletIs lifted from the desktop publishing terminology.
bulletRequires a minimal coding to create sophisticated web pages that have a common theme in appearance.

History of CSS

bulletThe World Wide Web Consortium (W3C) published a set of standards in December 1996 referred to as the "Cascading Style Sheets, Level 1" standards.
bulletFollowed in December 1998 by the "Cascading Style Sheets, Level 2" standards. 
bulletLevel 2 was a major revision that almost doubled the size of the CSS language by adding 42 new properties commonly referred to as CSS2.

Using CSS...

bulletThere are three basic types of style sheets:
  1. Inline - via the style attribute; tags are modified on a case-by-case basis throughout a document.  e.g., <h1 style="color: blue; font-style: italic">Text </h1>
  2. Document-level - styles are defined by a <style> tag in the head.
  3. External - link tag is used to identify a separate file with style information.  Click to view the external sheet.
bulletStyle syntax:
bullet3 parts of a style "rule" - 
  1. tag selector (e.g., H1, P)
  2. curly brace {}
  3. semi-colon separated list of one or more style property:value declarations (e.g., align:center)
bullet They are not case sensitive.
bullete.g., tag-selector {prop1: value ; prop2: value1 value2 value3; ...}
bulletMultiple tag selectors can be used.  e.g., H1, H2, H3 {text-align: center}
bulletStyle classes - 
bulletRegular - based on primary document objects, e.g., H1, H2, P , specific tags are identified, e.g., P.abstract {font-style: italic}  ....  <p class=abstract>
bulletGeneric - create a generic class that can be used anywhere., e.g.      .italic {font-style: italic}  ....  <p class=italic>

Example of styles - note the tag name, curly brackets, property, and value:

H1 {
margin-left: 15;
font-family: Arial, Helvetica;
font-size: 24pt;
color: "red";
}

p {
font-family: Arial, Helvetica;
font-weight: normal;
font-size: 12pt;
color: "black";
}
(NOTE: the following must be applied with a DIV tag)
.demo1 {
COLOR: blue;
font-weight: bold;
}

 

bulletStyle properties - properties that can be used control how the browser presents content.  Uses property values (5 types): keywords, length values, percentage values, URLs, and colors.
bulletSpan tags are useful for changing styles within a particular part of a document.

End-User issues:

bulletGreat for creating consistent, great looking multi-page documents.
bulletSpecial needs and layouts can be defined and enforced.

Developer issues:

bulletIt is difficult to keep track of all the possible combinations.  Keep a good reference handy.
bulletWYSIWYG editors are getting better at doing style sheets.
bulletBe aware of differences in how IE and Netscape handle styles.
bulletTest across browsers. 

CSS Style Attributes

The following is a sampling of attributes (not all of them - for more see the summary)...

Fonts

bulletfamily (e.g., font-family:Arial)
bulletsize, font-size: 24
bulletstyle, font-style: italic
bulletweight, font-weight: bold
bullettext decoration, text-decoration: underline
bulletcolor, color: red ... color:#040588 ... color:rgb(255,255,255)

Backgrounds

bulletcolor, backgroud-color:white
bulletimage, background-image:url(file)

Text

bulletword spacing, word-spacing: 10pt
bulletletter spacing, letter-spacing: 3pt
bulletalignment, text-align: justify

Technical Resources on StyleSheets

bulletDevGuru CSS2 Reference -- an excellent resource!
bulletW3C Resource: http://www.w3.org/Style/CSS/ 
bulletMicrosoft CSS Reference
bullethttp://internetbrothers.com/css_basics.htm 

Examples

The following examples illustrate a variety of techniques.  Use the view source function of your browser to see the HTML and how they work.

bulletCSS - Page-Based Inline Styles
bulletCSS - Page-Level Styles
bulletPage-Level Styles Attached to a Page (Compare to 02-2)
bulletCSS - In Both Netscape and IE
bulletCSS - Using an External Style Sheet - CSSreference.css.txt (click to view the stylesheet)
bulletCSS - External Style Sheet - More Examples -CSSreferencev2.css.txt (click to view the stylesheet)
bulletCSS - Div Demo IE Browser Only
bulletRelative Positioning via CSS3
bulletHello World - Simple DHTML

 

Home ] Up ] Computer Architecture ] Programming Bootcamp ] Database Bootcamp ] Visual BasicS ] Web Basics ] Web Multimedia ] Advanced Web Topics ] Developing Web Sites ] XML Technology ] Web Glossary ]

Copyright © 1999 - 2005 
ThePlace - Written and Sponsored by Dave Hillman