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
Prepaid Phone Card
Laptop Batteries
Dental Insurance
Corporate Gifts
Data Center Solutions
Promos and Premiums
Car Donations
KVM Switches
Promote Your Website
GPS Devices
Desktop Computers
Best Price
Imprinted Promotions
Auto Insurance Quote

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


  Rethinking the Datacenter
Sponsored by HP
Today's datacenters need to increase utilization, get control over power and cooling costs, and align with business objectives. Download this eBook to learn about the challenges facing the data center in a world where digital information is growing at a torrid pace and costs are being held in check. Learn more. »
 
  Putting the Green into IT
Sponsored by HP
Electricity use in data centers is skyrocketing, sending energy bills through the roof, creating environmental concerns and generating negative publicity. "Going Green" means looking to technologies like virtualization, energy-efficient chips and racks, and implementing policies that extend beyond the data center. Learn more. »
 
  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. »
 
  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. »
 
  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

Summary Part One

This should be enough to get you started with Style Sheets.

Remember to include comment tags around your rules to hide them from older browsers.

For your first style sheet, lets keep it simple. We'll design a style sheet using HTML elements as selectors, inserting it into the HEAD element of a single document. Linking to an external style sheet will come later.

Start with the Style element, adding comment tags right away so you don't forget them.

	<STYLE TYPE="text/css">
	<!--
	
	 -->
	</STYLE>

Now lets decide 'how' we want our document to look. Remember, use Style Sheets to enhance your web page, but don't design so that the page depends on them.

We can add a little color by specifying the color of different elements, a burgundy to header elements, brown for regular text, blue to italic and red to bold. A body background color of light yellow to set the whole thing off. None of these colors will in any way affect how the page is displayed in non-capable browsers, but will enhance the over all affect in browsers capable of viewing them. We'll add a touch of class with an Arial font throughout. Notice that the font-family element is specified in both the header element Selectors and the P Selector. The totally correct way would have been to put the font-family into the BODY declaration, but not all browsers will display it properly whereas if it is placed in the more specific Selectors, it will display. There was no need to put the font-family into the B and I Selectors as they inherit the property from the P Selector.

If you check the Document Source, you'll notice that even though I've specified H1 and H3 headers should be centered in the style sheet, I've also put them between the <CENTER> tags within the document. This ensures that your headers will be centered even in browsers that do not support Style Sheets. There will come a time that this method will not validate, but during the transitional phase it will. Once CSS is more widely supported and more firmly established, you will have to decide which is more important, writing valid HTML, or displaying centered text on non-CSS capable browsers.

<STYLE TYPE="text/css">
<!--
BODY   {background	: #FFFFCC;
	color		: #663300
	}		

H1, H3 {background	: transparent;
	color		: #660000;			
	text-align	: center;
	font-family	: Arial, Helvetica, sans-serif;
	}

P	{font-family	: Arial, Helvetica, sans-serif;
	}

B	{color		: red;
	background	: transparent;
	}

I	{color		: blue;
	background	: transparent;
	}			
 -->
</STYLE>

Notice in the above style sheet, that the B and I Selectors have a background property in their Declaration. The background property sets the color of the background behind the text. While it is not essential that the background property be used, it is recommended when the color property has been specified.

The same is true of the various font alternatives in the P Declaration. It is not essential to have alternate fonts, but it is recommended. Also recommended is the generic font as the last alternative in the Declaration.

View Enhanced Page View Non-Enhanced Page

Inheritance
Putting Style Sheets in Perspective: Table of Contents


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