Sunken/Highlighted Input Fields with CSS
One thing I really like about TheServerSide's new look is the sunken input boxes (that light up on focus) in the top right corner. I noticed that Macromedia does this on a lot of their form's too. It's good stuff. Here's how easy it is to add this "feature".
In your stylesheet, add the following class definitions:
/* for cool looking "sunken" input boxes, from www.theserverside.com */ form#searchForm input { padding-left: 4px; margin: 1px 1px 1px 1px; border: 1px solid black; color: #777; background-image: url(../images/input_white.gif); } form#searchForm input.focus { margin: 0px 0px 0px 0px; border-bottom: #ffdead solid 2px; border-right: #ffdead solid 2px; border-left: #c07300 solid 2px; border-top: #c07300 solid 2px; color: #000000; }
Of course, restricting these classes to one form (as I've done with form id="searchForm") is optional. Then in your form's input fields, add: add a couple of onfocus and onblur event handlers:
onfocus="this.className='focus'" onblur="this.className=''"
You'll also need to grab the background image and put it on your site. If you're adding this to a form in your webapp, it might be easier to add all the event handlers with JavaScript:
var inputs = document.getElementsByTagName("input"); for (i=0; i < inputs.length; i++) { inputs[i].onfocus=function() {this.className='focus'}; inputs[i].onblur=function() {this.className=''}; }
Thanks to the guys at TheServerSide for showing me how to do this - I dig it.
Posted by nowak on January 14, 2004 at 08:45 PM MST #
Posted by Matt Raible on January 14, 2004 at 09:46 PM MST #
Posted by Christiaan Neijens on March 04, 2004 at 09:20 AM MST #
Posted by Matt Raible on March 04, 2004 at 03:39 PM MST #
Posted by 81.69.109.40 on November 28, 2004 at 08:30 AM MST #
Posted by Sanjiv Jivan on October 31, 2005 at 09:52 AM MST #
Posted by Sanjiv Jivan on October 31, 2005 at 09:53 AM MST #
<INPUT type="radio" name="option"> Good <INPUT type="radio" name="option"> O.K. <INPUT type="radio" name="option"> Bangin <INPUT type="radio" name="option"> Bad <INPUT type="radio" name="option"> Horrible <INPUT type="radio" name="option" CHECKED>Getting There
Select an option:
<INPUT type="checkbox" name="selection" CHECKED> Beat 1 <INPUT type="checkbox" name="selection"> Beat 2 <INPUT type="checkbox" name="selection"> Beat 3 <INPUT type="checkbox" name="selection"> Beat 4 <INPUT type="checkbox" name="selection"> Beat 5 <INPUT type="Submit" VALUE="Submit"> </FORM>
Posted by Chuck on July 29, 2006 at 09:16 AM MDT #
Posted by 205.233.28.39 on October 25, 2006 at 03:29 PM MDT #
Posted by Md.Tahmilur Rahman on December 05, 2006 at 10:16 AM MST #
Posted by 68.189.242.81 on April 10, 2007 at 01:48 AM MDT #