WebDeveloper.com �: Where Web Developers and Designers Learn How to Build Web Sites, Program in Java and JavaScript, and More!   
Web Developer Resource Directory WebDev Jobs
Animated GIFs
CSS
CSS Properties
Database
Design
Flash
HTML
HTML 4.01 Tags
JavaScript
.NET
PHP
Reference
Security
Site Management
Video
XML/RSS
WD Forums
 Client-Side
  Development

    HTML
    XML
    CSS
    Graphics
    JavaScript
    ASP
    Multimedia
    Web Video
    Accessibility
    Dreamweaver
    General
    Accessibility
    Dreamweaver
    Expression Web

    General

 Server-Side
  Development

    PHP
    Perl
    .NET
    Forum, Blog, Wiki & CMS
    SQL
    Java
    Others

 Site Management
    Domain Names
    Search Engines
    Website Reviews

 Web Development
  Business Issues

    Business Matters

 Etc.
    The Coffee Lounge
    Computer Issues
    Feedback




CSS Simplifies Your Life
Part 1

by Scott Clark
First published February 1998

Old hat? Then why aren't you using them?

Last month we looked at Dynamic HTML and how to use it. The knowledge of cascading style sheets greatly facilitates the use of Dynamic HTML, and many of our readers asked for more info on CSS to help them get started.

By now most of us are aware that cascading style sheets can be used to control style and layout of a Web page, or build a style sheet "standard" that can be repeatedly used on a Web site. This "template" approach to designing a site enables developers to create a consistant look for corporate documents, while keeping style separate from content.

Want to change the way a page looks? Simply change the style sheet once and all the pages which use that style are instantly changed as well. So why haven't more people been using style sheets? Aside from the fact that only the 4+ browsers (Navigator 4+ and MSIE4+) can use them, perhaps it's because folks simply don't know how useful they can be, and how simple they are to use.

The use of CSS can be seen on many of today's leading Web sites, including WebReference.com and CNET, among others. If you visit the sites using one of the aforementioned CSS-capable browsers, you're seeing CSS in action. On the page you're currently reading, for instance, all of the font styles and headlines are controlled by style sheets instead of FONT tags. And the pages actually look almost identical under both MSIE4 and Netscape4, as the basic style sheet format is supported by both of them.

If you're wondering whether the same CSS specification is used by both browsers, the answer is yes ... almost. Although CSS will work for either browser, each has its own methods of utilizing dynamic HTML and style sheets. Netscape is favoring the use of JSS, or JavaScript style sheets, which are characterized by the TYPE="text/javascript" parameter of the STYLE tag. The format for the CSS used by JavaScript SS is different as well.

Likewise, Microsoft has made it extremely easy to use CSS to dynamically create dynamic effects. For instance, if you are using MSIE4, run your mouse over the words "Old hat? Then why aren't you using them?" at the top of this page. That little effect uses one line of code:

 <H4 onMouseOver="this.style.color='blue'" onMouseOut="this.style.color='gray'"> 

Most CSS techniques, however, may be used for both browsers. Did you notice that the hyperlinks on this page are not underlined? One line in the Style Sheet did that for the whole page, using the "text-decoration" property:

 A:link { background: white; color: blue; text-decoration: none; } 

If you're using an older version of Netscape or MSIE to view this page, it simply shows plain, unformatted text. Or rather, if the text is enclosed by a normal HTML tag, the normal effects of the tag are what shows up in the browser.

  [ CSS Simplifies Your Life:
Part 2 > ]




HTML5 Development Center


Recent Articles