• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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]



0
janeworley
Asked:
janeworley
  • 2
1 Solution
 
LZ1Commented:
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

0
 
janeworleyAuthor Commented:
I think your code will apply the styles on disabled fields as well as enable ones?
0
 
LZ1Commented:
Yes.  The focus is when someone is typing in the field.  The other is the default styling when it's idle.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now