How Can I apply a css style to a dropdownlist?

JessyEzzy
JessyEzzy used Ask the Experts™
on
I am applying a style for my form fields here it is:

cella_form {
font-size: 10px;
border: 1px;
border-color: 4BBA5C;
border-style: solid;
}

I have set the Css Class property for all the controls with the style name,it's showing fine for textboxes but dropdownlists are not affected, I want a solid green border to be shown.
I am using ASP.NET controls.
Can anybody tell me how to apply the style for the dropdownlist?
Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
A link to your actual page would be nice.

And you should have a period before the class name in the style sheet, eg ".cella_form {"
Furthermore, "#4BBA5C", not "4BBA5C".
Top Expert 2004

Commented:
>>Can anybody tell me how to apply the style for the dropdownlist?

Yes, you can't - at least in IE :-)
It's only supported in NS7 and Mozilla
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Strictly speaking standard SELECT dropdown lists don't have borders in the sense that other elements do - you can't set it to none, change its width or apparently color.

The only things I've successfully manipulated are the background and text colors, font attributes and width. The height attribute has no effect either on the closed or opened (dropped) states but you can control the number of lines it drops open to with the HTML size attribute.

If you are really determined you can build your own dropdown list by overlaying a standard text input with a hidden list that you display whenever someone clicks your (fake) dropdown button. The only signifigant advantage to this technique is you can let someone type into the text field values that aren't yet on the list and add them to it dynamically for future quick reference. Which is why I bothered to work this all out ...

Let me know if you really HAVE to make the SELECT borders different and I'll send or post an example. But it is an awful lot of work ...
Hi JessyEzzy,

You can style your font-size in IE, but not the border. The border can be styled only in Mozilla, Netsacape, and then only on the options.
Top Expert 2004

Commented:
I'm sure I've heard that before somewhere :-)
> I'm sure I've heard that before somewhere :-)

sean I noticed your comment (above), I just wanted to add that you CAN add the font-size style for IE, and the border only for option in Mozilla. Just being more specific.. not trying to steal anyone's thunder here:)
Top Expert 2004

Commented:
That's okay DD, I don't have any thunder to steal - I'm too full of sunshine.

Author

Commented:
Here is a link to how the form looks like:

http://JessyEzzy.europe.webmatrixhosting.net/form.aspx
Top Expert 2004

Commented:
So what would you like to know?

Author

Commented:
Actually after what you said about it's not being supported in IE it seems that I can't do anything to it, even though the ones who's going to use the form are using IE, so there is nothing i need to know.
Thanks.
Top Expert 2004
Commented:
Oh okay :-)
I thought you wre looking for more...

If you ever decide to go the custom dhtml route:
http://webfx.eae.net/dhtml/select/jsGenerated.html

A bit of work for a select box, but it's there in case you need it.

Thanks,
Sean

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial