Two columns Three columns Mixed cols and rows Gallery Archives Clean & Clear Dark or Black High Contrast/ Impact Blog Designs New Corporate/ Professional Unconventional Designs Liquid layouts Web Design Firms Our Favorites What's Popular Last 20 submissions
Horizontal Menus Vertical Menus Multiple/ Nested Levels

CSS Examples :focus pseudo class (highlight form element onFocus)

Date: 09/30/2004 :focus pseudo class (highlight form element onFocus)

Author: CSS Drive

The ":focus" CSS puesdo class applies the style to an element when the user sets focus on it. Using it, for example, you can easily highlight the form element the user is currently typing in. Note that ":focus" is currently not supported in Internet Explorer (as of IE 6.0), but is in Mozilla/ NS7+.

1) Name:

2) Email address:

3) Comments:

The HTML:

<form>
<p>1) Name:<br />
<input type="text" size="40"></p>

<p>2) Email address:<br />
<input type="text" size="40"></p>

<p>3) Comments:<br />
<textarea rows="5" name="comments" cols="45" wrap="virtual"></textarea></p>

<p><input id="actualsubmit" type="submit" value="Submit"></p>
</form>

The CSS:

input:focus, textarea:focus{
background-color: lightyellow;
}

Comments (14)

Funny, lol You said read the page before posting, but you should read posts before commenting:

(as of IE 6.0) is what it says, and Joey was commenting about IE7.

#1: mikemike on 12/10 at 12:24 PM

mmm nice

#2: poojew on 01/29 at 05:01 AM

css textboxt input (textfield) style - examples - -
http://www.css-lessons.ucoz.com/textbox-css-examples.htm

#3: chester on 05/24 at 09:55 AM

The input:focus highlighting stuff is really cool!
Thanks.

#4: nOOn on 06/26 at 11:26 AM

Post a Comment: Guest (Login or Register)

Name: (Required)

Email: (Required)

(NOT shown on page)

URL:

(Shown on page if entered)

Comments: (Required)

Remember my personal information
Notify me of follow-up comments?

Submit the word you see below:


CSS Forums

CSS Forums: latest threads Last Post Info
Nested Lists and display: (2) 07/04/2008 02:31 pm
By: vishwebdesign
List your resource websites! (1) 07/03/2008 07:17 pm
By: newyoda
Free Wordpress Theme Heaven (1) 07/03/2008 11:08 am
By: topwpsites
Free Wordpress Theme Purple Butterfly (1) 07/02/2008 04:05 pm
By: topwpsites
Alignment Issues (2) 07/01/2008 09:03 am
By: Denis

Last Comments: