Link to home
Start Free TrialLog in
Avatar of janeworley
janeworley

asked on

Set style only on enabled text boxes

I want to set the style only on enabled text boxes. If they are disabled I want the default style to prevail.

I tried this but it doesn't seem to work:


input[type="text"][enabled]


Is this proper syntax and I'm just missing something elsewhere?


This does work for disabled text boxes:

input[type="text"][disabled]



Avatar of LZ1
LZ1
Flag of United States of America image

This is what I use for all my forms to make them more user accessible.  You can tailor it to your specific application obviously by just changing the CSS.

input[type="text"],
input[type="file"],
input[type="password"],
textarea,
select{
	border: 1px solid #9db4bd;
	width: 300px;
	padding: 7px;
	font: 16px Verdana, Geneva, sans-serif;
	color: #CCC;
	background: url(../images/trans_wht.png);
}

input[type="text"]:focus, 
input[type="text"].focus,
input[type="password"]:focus, 
input[type="password"].focus,
select:focus,
select.focus,
textarea:focus,
textarea.focus{
	border: 1px solid #333;
	padding: 7px;
	background: #FFF;
	color: #333;
	font: 16px Verdana, Geneva, sans-serif;
	width: 300px;
}

Open in new window

Avatar of janeworley
janeworley

ASKER

I think your code will apply the styles on disabled fields as well as enable ones?
ASKER CERTIFIED SOLUTION
Avatar of LZ1
LZ1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial