Improve Site Performance Increase Site Traffic Monitor Site Uptime Webmaster Resources NetMechanic Home Looking For Help? Partner Programs Privacy Policy Contact Us Press Room
NetMechanic Home LOGIN | HELP | ABOUT US | PRODUCTS | SITE MAP
NetMechanic Menu
Over 52 Million Web Pages Tested!     
 

Search for:


Your Email:

I would like to receive my newsletter in:
HTML format
Text format



Volume 8 (2005)
   September
   June
   April
   March
   January

Volume 7 (2004)
   November
   September
   July
   June
   May
   April
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 6 (2003)
   December
   November (Part 2)
   November
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 5 (2002)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 4 (2001)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June (Part 2)
   June
   May (Part 2)
   May
   April (Part 2)
   April
   March (Part 2)
   March
   February (Part 2)
   February
   January (Part 2)
   January

Volume 3 (2000)
   December (Part 2)
   December
   November (Part 2)
   November
   October (Part 2)
   October
   September (Part 2)
   September
   August (Part 2)
   August
   July (Part 2)
   July
   June
   May
   April
   March
   February
   January

Volume 2 (1999)
   December
   November
   October
   September
   July
   June
   May
   April
   March
   February
   January

Volume 1 (1998)
   December
   November
   October
   September

 

CSS Tip:
Be Careful With Curly Braces

by Tom Dahm,
Chief Operations Officer,
NetMechanic, Inc.

  
February 1999
Vol. 2, No. 2
 • Search Tip
 • CSS Tip
 • HTML Tip
  

When building an inline style sheet, beware of using the curly braces to enclose your style. This can cause your style to be incompatible with multiple browsers.

Cascading style sheets are powerful new features of HTML 4 that give you much more control over the look of your web pages. Unfortunately browser support for CSS has lagged behind the standards, making it hard to know exactly how the major browsers will handle your styles. If you aren't aware of these issues, you'll encounter serious compatibility problems with your site. The definition of inline style sheets is a good example of this.

You can define a style sheet for your document in one of two ways:

  • As a document-wide style contained inside a STYLE tag
  • As an element-specific style using the STYLE attribute

For example, if you were defining a style to be used throughout your page, you might define it like this:

<STYLE>
  P { color : red }
</STYLE>

<P> This is red text </P>

This style would render all paragraphs in your page in red text.

But suppose you wanted to apply this style to just one paragraph in your page. One way to do this is to define an inline style sheet as follows:

<P STYLE="color : red">This is red text</P>

Notice that you don't use the curly braces to contain the inline style declaration. Curly braces are used to separate one or more style declarations from the style selector to which they apply (in our example the style selector is the P tag). For an inline style sheet the style is already tied to a single page element, so you don't need a selector or curly braces. In fact, use of curly braces is a violation of the style sheet standards.

However, Microsoft Internet Explorer forgives this error. If you include curly braces in your inline style sheet, MSIE will display the page as you intended. Netscape Navigator applies a strict interpretation of the standards and rejects any inline style that includes the braces. That means Navigator won't display your style at all.

Keep that in mind if you use Internet Explorer as your default browser. You still need to test your page under both major browsers.



Rate This Tip:
Not Useful Useful Very Useful   
 
NetMechanic Tools
HTML Toolbox
Browser Photo
Server Check
Search Engine Starter
Search Engine Tools
GIFBot
Newsletter
HTML Tutorial and Tips
Search Engine Tutorial
Accessibility Information
Browser Problem Tutorial

Company Info
Products
About Us
Contact
Advertise
Link To Us
Jobs
Privacy Policy
Partner Programs
Press Room
RSS Feed
Support
 



Powered by Overture!

 
     
 
   
 
     


Keynote Home
Copyright © 1996-2007,
Keynote NetMechanic
All rights reserved.