logo-dw

by ranjan

I have been designing and developing web applications for 7 years + in India, Australia and USA.
Currently my business caters to fellow designers and developers providing help and support to with custom script and dreamweaver extensions, applications in asp vbscript and conversions to css / accessible layouts.

Styling Google Autofill Form Fields

This tutorial is no longer working.

  1. The page for the dreamweaver extension does not exist anymore
  2. Use the css code below instead, much simpler
input[type='text'] { background: #FFFFFF !important; }

Regards, Ranjan

What is Google Autofill?

The Google AutoFill feature allows you to store personal information about yourself (Name, Address, eMail and Phone Number as long as your form conforms to Electronic Commerce Modeling Language standard so that it can be automatically inserted into fields on website forms. The information you enter can be used on any web form. By default if a user enables google Autofill feature the relevant form fields are styled with a yellow background.

While the feature is extremely helpful, the yellow background may not fit into the overall color scheme of your website.

Killing the Yellow Backgrounds

Using the Kill Google Autofill Script Extension you could get rid of the yellow backgrounds. This however does not kill the actual Autofill functionality, The auto fill feature still works however there is no visual indication of what Google's toolbar will fill up.

The extension interface to add the script can be accessed from the Commands dropdown menu, once a text field / list field is added to the document.

Image18 (36K)

Just click Add to add the script

Image19 (25K)

Styling the Form

To distinguish the Autofill fields from the Non-Autofill fields we need to style the form. We do this by redefining the input and select tags.

input, select {
background: #E0DFE3;
border: 1px solid #333333;
font-size: 75%;
width: 150px;
}

Now to distinguish the fields that can be filled with the Autofill option, create a class with a different style. In this case I have called the class .google and declared its background color.

.google {
background: #899191;
}

Finally adding a note to inform the user is all that is required to complete your custom styled Google Autofill form.

Since Google Toolbar is available only for Internet Explorer, we can hide the custom style from other browsers using Internet Explorer Conditional Statements.

<!--[if IE]>
<style>
.google {
background: #899191;
}
</style>
<![endif]-->

However this still leaves the message to be hidden from other browsers. Just set the display property of the message to "none'. and set it to "block" within the conditional statements. Here is the final form.

<style type="text/css">
<!--
body {
background: #FBFBFC;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
label {
font-size: 80%;
color: #333333;
}
input, select {
background: #E0DFE3;
border: 1px solid #333333;
font-size: 75%;
width: 150px;
}
table {
background: #C5C7CF;
border: 1px solid #003C74;
}
.note {
display:none;
}
-->
</style>
<!--[if IE]>
<style>
.google {
background: #899191;
}
.note {
font-size: 69%;
background: #899191;
display: block;
}
</style>
<![endif]-->