Click here to Skip to main content
12,077,586 members (48,354 online)
Click here to Skip to main content

Stats

52.7K views
577 downloads
20 bookmarked
Posted

How to change an input style with CSS

, 15 Feb 2012 CPOL
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.
css_color_change.zip
css_focus_color_change_demo.zip
css_focus_color_change_src.zip
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title>CSS Form field color change... on focus... By Luciano D. Iannicelli</title>
<link rel="stylesheet" href="css_color_change.css" type="text/css" media="screen"  />
</head>

<body>
<table width="580" border="0" cellspacing="0" cellpadding="2">
				<tr>
                  <td  colspan="3">
                  <hr align="center" noshade="noshade" size="1" color="#C0C0C0" />
                  </td>
				</tr>
				<tr>
					<td width="200" valign="top">
                  Name<br>
					<input class="combo" type="text" name="nom" size="22" /><br>
					Surname<br>
					<input class="combo" type="text" name="ape" size="22" /><br>
					Telephone nr<br>
					<input class="combo" type="text" name="tel" size="22" /><br>
					Email<br>
					<input class="combo" type="text" name="ema" size="22" /><br>
					<td width="180" valign="top" align="left">Comment<br>
					<textarea class="campo" name="con" rows="8" cols="32" wrap="physical"></textarea>
                  <br><div align="right"><input class="button" type="submit" name="submitButtonName" value=" Send " /></div>
                  </td>
					<td width="200" valign="top" align="left">
                  </td>
				</tr>
			</table>
</body>

</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

luciannil
Web Developer
Argentina Argentina
No Biography provided

You may also be interested in...

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