Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us
Build a Server Rack
Shop
Laptops
Corporate Gifts
Online Education
Holiday Gift Ideas
Boat Donations
Promotional Gifts
Online Shopping
Promos and Premiums
KVM Switches
Rackmount LCD Monitor
Desktop Computers
Compare Prices

Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


  Managing the Modern Network
Sponsored by HP
In a global economy where information crosses the globe in an instant, and where Web-based applications power business, it's more important than ever to ensure your network is safe from threats and optimized to deliver the data your business needs. »
 
  Business Service Management: Generate Revenue Through IT
Sponsored by HP
IT must now help organizations attract, retain and grow customer relationships and increase customer satisfaction. Business service management (BSM) helps lay the foundation by managing services in dynamic support of business requirements. Learn more. »
 
  Evaluating Software as a Service for Your Business
Sponsored by Webroot
Is Software as a Service just hype, or is something really going on here? See if your company can benefit as SaaS tries to change the face of the enterprise. »
 
  Storage Networking: Configuration and Planning
Sponsored by HP
The most critical part of setting up a SAN is configuring each individual disk array. This guide examines configurations for SAN-attached servers and disk arrays, and looks at the future of IP storage. »
 
  Is Your Disaster Recovery Plan Good Enough?
Sponsored by HP
Preparing for a disaster is more often than not part of the storage planning process, and it is one of the most difficult tasks, since it includes local hardware and software, networking equipment, and a test plan. Learn how to get disaster recovery right. »
 
Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

June 17, 1998

Putting Style Sheets in Perspective

Methods of Combining The Style Sheet With HTML

There are four ways to combine Style Sheets with HTML.

  1. STYLE element
  2. Style Attribute
  3. Link element
  4. import using CSS @ import notation.

The Style Element

The Style element is inserted into the HEAD of a document with all of the rules placed between the opening and closing tags. Only the document that the STYLE is embedded in will be affected.

<HEAD>
<STYLE TYPE="text/css">

	H1, H2, H3 {
		color: blue;
		font-family: Arial;
		}

</STYLE>
</HEAD>

Style Attribute

Style Sheets may be applied to individual elements by using the Style Attribute. This may sound confusing as most people begin by thinking in terms of a Style Sheet as being a separate and much larger entity. Remember, though, that a Style Sheet can be as small as one rule.

Using the Style Attribute you can bypass the Style Element and put declarations directly into individual start tags.

<H1 style="color: blue;
	font-family: Arial">
</H1>

Obviously, if you are making document wide changes, you won't want to use this method, but if you are only adding style to one individual instance of an element, this method works very nicely. Keep in mind that using the Style Attribute will necessitate making changes to each instance if you should later decide to change the style of the document.

Link Element

To use the Link Element, your Style Sheet must be a separate document.

<LINK	REL	= STYLESHEET
	HREF	= "mystylesheet.css"
	Type	= "text/css"
	>

You must include the "rel=stylesheet" attribute or the browser will not load the style sheet.

Import Using CSS @ import Notation.

When a document needs additional style, above and beyond what is in the document style sheet, you will need to use the @import declaration rather than the LINK element to pull it into your document.

The @import should be the first declaration in your Style Sheet. Local rules, (rules contained in the document), will over-ride the @import rules.

Multiple @import declarations may be used, with each subsequent @import declaration over-riding the preceding one.

<STYLE type="text/css">
@import "differentstyle.css";
H1 {	color: blue;
	font-family: Arial
	}
</STYLE>

Additional Resources:

Selectors
Putting Style Sheets in Perspective: Table of Contents
Inheritance


Up to => Home / Authoring / Style / Sheets / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers