Click to return to the DHTML, HTML     
Web Workshop  |  DHTML, HTML & CSS

A Coast-to-Coast Cascade of Style Sheets


Nadja Vol Ochs
Design Consultant
Microsoft Corporation

October 14, 1997

The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices)"Site Lights" column.

I recently had the opportunity to present at two Web design industry conferences: Web97 Design and Development in Washington, D.C. and Seybold San Francisco 98 in San Francisco, California. The session at Web97, entitled Cascading Style Sheets: Layout and Design, provided an overview of Cascading Style Sheets (CSS) and Dynamic HTML (DHTML). The four-hour Seybold session, Designing with Dynamic HTML and Cascading Style Sheets, provided an in-depth tutorial covering DHTML, CSS, CSS positioning, and font embedding. I send thanks to everyone who attended these sessions. It was a pleasure to meet you, and to see all the interest and excitement about Web design possibilities using Cascading Style Sheets and Dynamic HTML.

This Site Lights column is dedicated to bringing those of you who attended the sessions, and other curious minds, the HTML content and samples I presented and discussed. Please note that these samples require Internet Explorer 4.0, and may not demonstrate properly in other browsers.

Kicking off the Sessions

To start off the sessions, I showed a simple splash page, which includes an enlarged GIF of one of my sister's paintings and an animated GIF composed of various Webdings Non-MSDN Online link characters.

Starting splash screen

The large TV monitor graphic also comes from the Webdings font. Webdings is a free TrueType font that is installed with Internet Explorer 4.0, and it can be downloaded for free from the Microsoft Typography Non-MSDN Online link Web site. To achieve the layout of this page, I used basic CSS positioning.

The next page provides the title of the session, my name, and my e-mail address. This page looks similar to what you might see in a traditional slide show presentation, but it is composed entirely of HTML. By applying CSS filters, I created the typographic effects (the drop shadows and blurred edges). This page also uses an embedded style sheet to set type size and colors.

The main menu for both presentations uses a linked Cascading Style Sheet and demonstrates various negative-margin effects.

What are Cascading Style Sheets?

Cascading Style Sheets are design templates that provide augmented control over presentation and layout of HTML elements. They allow you to separate the way you design information from the HTML content.

What are the Benefits?

Using style sheets, you can create Web pages with minimal graphics, and therefore much smaller downloads. Style sheets also provide you with a higher level of typographic control, and they enable you to make changes to an entire site through the use of linked style sheets.

Where are Good References?

I urge you to visit the World Wide Web Consortium (W3C) Non-MS link to learn about the CSS standard and the new CSS Positioning draft. Print out the specifications and drafts as resources, and use them as your springboard for learning about CSS. The site also has a wonderful set of references, ranging from books about CSS to other Web sites that use and teach CSS. (You'll also find references listed at the end of this article.)

Dynamic Styles

Creating dynamic styles is very easy! Once you understand CSS basics, all you need to know is a few lines of script -- and you can have any HTML tag change dynamically by applying CSS attributes to it. For example, inline script events allow you to dynamically change the style attributes of any HTML element when you touch it with the mouse (onmouseover) or move the mouse off of it (onmouseout).

For example, the following headline code:

<H4 onmouseover="javascript:this.style.color='#6633FF'"
   onmouseout="javascript:this.style.color='#000000'">
This headline will change to purple
when the mouse touches it,
and back to black when the mouse moves off of it</H4>

creates this headline:

This headline will change to purple when the mouse touches it, and back to black when the mouse moves off of it

You can find information in the styles section. Several of the samples that I demonstrated in the classes come directly from two previous Site Lights articles about Dynamic HTML (Filter It, Scale It, Move It, Hide It with Internet Explorer 4.0) and Dynamic Cascading Style Sheets (Is Your Site Made with Style?). For example, the swimming fish sample illustrates Cascading Style Sheet positioning, Dynamic HTML, and Structured Graphics plants. The DirectAnimation SDK Non-MSDN Online link provides documentation, samples, and tutorials to help users get up and running with DirectAnimation and the new multimedia controls included in Internet Explorer 4.0.

In my presentations, I used the Epicurious Food channel to illustrate dynamic movement of HTML elements. Part of the navigation for this channel is provided by a series of cafeteria trays sliding across the page. Dynamic HTML is used to activate the movement of the cafeteria tray GIF files, and for all the click events. Various CSS attributes are dynamically influenced via JavaScript. The position attributes of the cafeteria trays are manipulated via scripting. Also, when each tray is clicked, the static GIF is hidden, and an animated GIF is made visible. Download the Epicurious Food channel from the new Microsoft Active Channel Guide Non-MSDN Online link.

Here are two additional samples demonstrating CSS.

Using more than one linked style sheet: This sample illustrates using more than one linked style sheet on the page. As you click on the arrow, the sample cycles through 10 different linked Cascading Style Sheets.

Linked Style Sheet

JavaScript functions working with an embedded style block: This sample illustrates how you can use JavaScript functions to call various parts of an embedded style block. This changes the design of the content without having to leave or refresh the page.

Font Embedding

Two differing technologies and solutions are currently used to deliver fonts with Web pages. Netscape Navigator 4.0 supports Bitstream's TrueDoc Non-MS link technology, and Internet Explorer 4.0 supports OpenType Non-MSDN Online link Font Embedding. Bitstream's TrueDoc technology is based on delivering outlines of font characters, which are then converted into bitmap versions of those characters. The OpenType Font Embedding technology enables you to deliver font subsets or a full font family with your Web content.

The goal of my presentation was to provide a good understanding of how Internet Explorer's OpenType Font Embedding works. Here are three easy steps to help you start embedding fonts in Internet Explorer 4.0.

  1. Take a look at some of Simon Daniel's samples in the Microsoft Typography team's demos Non-MSDN Online link.
  2. Spend some time at the Microsoft Typography Web site. It has a great CSS gallery Non-MSDN Online link. Download the free Web fonts Non-MSDN Online link, including the cool Webdings font that I demonstrated and used in various samples.
  3. At the Typography site, download the beta version of the Web Embedding Fonts Tool (WEFT) Non-MSDN Online link, and learn more about how to use this tool Non-MSDN Online link. WEFT analyzes Web pages for you, creates the Embedded OpenType (EOT) font object for you, then adds the proper CSS font-embedding information to the page.
Font embedding in Internet Explorer 4.0 is enabled via CSS using the @font-face definition. Below is an example of a style block that was created using WEFT. The tool also creates a font object, which is a subset of the font. The font object is called an EOT file.
<STYLE>
<!--
@font-face {
    font-family: Mistral;
    font-style:  normal;
    font-weight: 700;
    src: url(MISTRAL.eot); }
-->
</STYLE>

Resources

Here are more references from the sessions:

Here are a couple books I referred to during both sessions:

Nadja Vol Ochs is the design consultant in Microsoft's Developer Relations Group.


10 CSS features

Here are 10 of the many features CSS technology brings to Web design. Each feature in the list below links to a sample. Or you can click through the samples by using the navigational arrows at the top of each sample page.

Fonts

Colors and Backgrounds

Text Decoration

Margins

Text Indent

Line Height

Letter Spacing

Initial Caps achieved using float

Clip

Position and Z-index

Filters

You can find more information about filters in my previous Site Lights column Filter It, Scale It, Move It, Hide It with Internet Explorer 4.0.



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.