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

 

HTML Tip:
Radio Buttons on a Colored Background

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

  
January 2000
Vol. 3, No. 1
 • HTML Tip
 • Load Time Tip
 • Server Tip
  

If you've ever tried placing an HTML form inside a colored table, then you've probably run into an annoying bug in many browsers. When you place a radio button on a colored table background, some browsers show a white square around the button, ruining the colored table effect.

To see what we mean, look at this sample code:

<form action="nothing.cgi" method="GET">

<b>What's your favorite color?</b>

<table bgcolor="#FFCC00" width="200" 
   border="0" cellspacing="0">
  <tr>
    <td>
      <input type="radio" 
        name="color" value="red">Red
    </td>
  </tr>
  <tr>
    <td>
      <input type="radio" 
        name="color" value="blue">Blue
    </td>
  </tr>
</table>

</form>

This creates a simple form with two radio buttons set against a gold background. If you view this form under any version of Netscape Navigator, it will look like this:

Form set against a colored table under NN4

Notice the white square around each radio button. You'll also see this problem under some versions of the AOL browser, and older versions of Opera.

The easiest way to avoid this bug is to tie an inline style sheet to your radio buttons, like this:

<input type="radio" name="color" value="blue"
  style="background : #FFCC00; color : black">

This technique uses the cascading style sheet "background" property to set the color of the radio button so that it blends with our colored table. Figure 2 shows how our table now looks.

Form using a style sheet, viewed under NN 4.02

That's much better.

Under CSS, every page element resides within a block whose properties can be manipulated. In this example, the "background" attribute sets the background color of the block, while the "color" attribute sets the foreground color used in the element's lettering.

In our example, we don't really need to set the "color" property, since this displays in black by default. But you'll need to set this property if you want to place a light-colored form against a dark background. Of course, you could get the same effect by wrapping the INPUT tag inside a FONT element.

Using a style sheet to correct the radio button bug works only under 4th and 5th generation browsers. So, while this fixes the problem for most people using Netscape, the bug will still appear under Navigator 3, plus older versions of the AOL and Opera browsers. These browsers make up less than 5% of the browser market though, so this correction should make your forms looks good for the vast majority of your audience.



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.