Click here to Skip to main content
Licence CPOL
First Posted 1 Nov 2006
Views 44,288
Downloads 430
Bookmarked 17 times

How to change an input style with CSS

By | 15 Feb 2012 | Article
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

Introduction

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.

License

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

About the Author

luciannil

Web Developer

Argentina Argentina

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionDidn't you test in IE6 before posting this article? Pinmembertcurtin8:01 7 Nov '06  
Generaldoes not work with my IE6 Pinmembermikedepetris23:07 6 Nov '06  
GeneralRe: does not work with my IE6 Pinmembermikedepetris0:11 7 Nov '06  
GeneralRe: does not work with my IE6 Pinmembertcurtin7:48 7 Nov '06  
GeneralRe: does not work with my IE6 Pinmembermikedepetris7:49 7 Nov '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120517.1 | Last Updated 15 Feb 2012
Article Copyright 2006 by luciannil
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid