If you are reading this, please get modern browser.
skip to main content | skip to main navigation | skip to secondary content

Input Field Drop Shadow

~ 4th May 2005. · 00:04 CET · permanent link · printer friendly ~

Amazing how I still receive many e-mails regarding those drop shadows in the input and textarea elements in web forms. This is very simple, so let’s explain it. All you need is background image of the drop shadow and a few CSS lines. Let’s begin with:

input, textarea {
    background: url(drop_shadow_image.gif) no-repeat 0 0;
}

You might want to add class name for type="text" fields, so they are differentiated from checkboxes, radios or submit buttons (they are all input elements):

<input type="text" class="input_text" id="..." name="..." />

and change CSS:

.input_text, textarea {
    background: url(drop_shadow_image.gif) no-repeat 0 0;
}

IE/Win has a problem with proper positioning of a background image in textarea element when you scroll inside it or maybe all others miss-behave. Anyway, we add:

.input_text, textarea {
    background: url(drop_shadow_image.gif) no-repeat 0 0;
}
/* not for IE/Mac \*/
* html textarea {
    background-attachment: fixed;
}
/**/

Wanted more? Nope, that’s all… : )

* Please keep in mind that this is a personal web site and it does not reflect the position or opinion of my respective employers, organizations or partners.

Typetester – compare screen type Supported by Veer.

What is this?

A web log of Marko Dugonjić, web professional from Croatia. Topics covered:

Translate this site

German, Spanish, Italian, French or Japanese (via).

See you there!

Feel like buying a book?

Try with maratz.com aStore

Worth visiting

top of the page | skip to main content | skip to main navigation | skip to secondary content