Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the text colour of a disabled SELECT box

Status
Not open for further replies.

Jonathan

Programmer
Mar 19, 1999
116
GB
Is it possible to change the foreground colour of a disabled SELECT dropdown? I have tried everything I can think of, and it still appears as grey text (although I can make the background colour anything I like). As a result, my form looks a bit rubbish. Please help!
Jonathan
jon_george1@hotmail.com

Working against: Visual Basic, Access, Visual Interdev, VBScript, JavaScript, Active Server Pages, SQL Server, Oracle, XML
 
As far as I know there isn't a way to do this...
Why not put an empty option at the top of the select? That way no one would see the font color...
 
here is smth jaredn advising with boxes:
thread215-66425 regards, vic
 
Yes u can. I use it for select box and text box. Probably won't wotk in NS. Does work for IE.
Use classes as follows:

.disabledParts {background:#eee none; color:#222; font-style: italic}
.enabledParts {background:#ffffff none; color:#000000; font-style: normal}
 
If you want to get more advanced you could use css2 selectors to set the color of only disabled select boxes on the page.

select[disabled] {
...style
}

select[readonly] {
...style
}

I believe that should work. Only in Netscape 6+ though -- its the only browser out there right now that supports even a mild degree of CSS2.
===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
and IE of course.
Trevman, r u sure u can change styles in "readonly" fields?
I think u can do that only if it's disabled, not readonly.
Wouldn't bet money on it, but it's still worth checking anyway.
 
Actually IE does not yet support CSS2 really at all. It gets the right and overflow properties and thats about it.

IT doesn't have suppport for fixed positioning or css2 selectors like I wrote in my previous message. ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
You can actually use a selector that will find a certian attribute of a tag and only apply the style depending on that attribute.

For instance, to set a certian style to only radio buttons, I could use the following selector:

input[type="radio"] {
.....style here
} ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Trevman,I thought u were talking about tags style of fields, but u were talking about attribute of tags style.
I did not know it's possible. Nice to know.

Anyway,In microsoft site, it says that IE DOES SUPPORT CSS2:
"Microsoft Internet Explorer 5.0 supports the latest in World Wide Web technologies for easy and fast development of Web-based applications. These technologies include dynamic hypertext markup language (DHTML) behaviors, XSL, XML 1, HTML 5, cascading style sheets version 2 (CSS2), Document Object Model, and ECMA-262 compliant scripting. And Internet Explorer is modular so developers can use portions of the code to enhance their own products. Version 5.0 also automates functions that traditionally fell to IT administrators in corporations."
(************************************
Also, in other site:
"Style sheets are governed by two specifications: CSS1 and CSS2. Netscape 6 is currently the most compliant browser, with Internet Explorer 5.5 not far behind. Both Internet Explorer 4 and Netscape Navigator 4.x support style sheets to some extent."
*****************************************************

So, in general there is almost full support in css2, by IE5+ AND full(?) support by NS6.
Maybe the feature u r offering is one of these which r supported only by NS6 (as u suggested).
Nice to know this feature anyway.
Thanks.
 
Well some of that is just MS prapoganda (spelling?). They might "support" css2, but that does not mean it has full compliance for css2. Internet Explorer 6 does not support CSS2 selectors nor does it support many values of the dislpay: attribute, such as fixed, and all the table values.(such as table-row, inline-table, etc.) ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
When I tried it (how many months ago?), I did select[disabled="disabled"] and that didn't work... I didn't think to try select[disabled], which works fine. I guess being xhtml compliant isn't always good...

There's still the problem that most people don't use Mozilla or Netscape 6+...but I guess that's their fault.

 
haha -- yeah sometimes I feel that way especially when trying to deal with IE5's wrong implemintation of the box model. ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top