Click here to Skip to main content
13,625,762 members
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 1 Nov 2006
Licenced CPOL

How to change an input style with CSS

, 15 Feb 2012
Rate this:
Please Sign up or sign in to vote.
This article describes how to use CSS to change any form field's style: color, border color, border line with, height, width, etc... when it's on focus. Works in IE & Mozilla.

Sample Image - CSS_focus_color_change.gif


This simple, short article will explain how to create an attractive and useful web form using CSS only. No javascript knowledge is required because not one javascript line is needed. Not a single one!

To start, just create the style you want, name it, then copy the style but in the name add ":focus" and that's all. After creating the CSS, then create the HTML form, link the CSS file, and add to the form whatever fields you want and assign them the style you just made. That's all, nothing else is needed.

To see it in action, download the fully editable example file.

That's all for now.

Regards from Argentina.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Argentina Argentina
No Biography provided

You may also be interested in...


Comments and Discussions

Generaldoes not work with my IE6 Pin
mikedepetris6-Nov-06 23:07
membermikedepetris6-Nov-06 23:07 
GeneralRe: does not work with my IE6 Pin
mikedepetris7-Nov-06 0:11
membermikedepetris7-Nov-06 0:11 
GeneralRe: does not work with my IE6 Pin
tcurtin7-Nov-06 7:48
membertcurtin7-Nov-06 7:48 
GeneralRe: does not work with my IE6 Pin
mikedepetris7-Nov-06 7:49
membermikedepetris7-Nov-06 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03-2016 | 2.8.180712.1 | Last Updated 15 Feb 2012
Article Copyright 2006 by luciannil
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid