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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format <option> tag

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
How do I control the styling for an <option> tag? I seem to be able to change its colour but not its font size or weight? Any ideas?

Code:
<style type="text/css">

.OrgRole
{
font-family: tahoma, verdana, sans-serif;
font-weight: bold;
}

.OrgUser
{
font-family: tahoma, verdana, sans-serif;
font-weight: normal;
color:#ff0000;
font-size:8px;
}

</style>

<select name="cboOwner" id="cboOwner">
	<option selected="selected" value="0">Select Role</option>
	<option value="2" class="OrgRole">Director Product Management</option>
	<option value="1000" class="OrgUser">Bar, Foo</option>
	<option value="41" class="OrgRole">Asst DPM</option>
	<option value="115" class="OrgRole">Asst Asst DPM</option>
</select>
 
You will not be able to do this reliably cross-browser or cross-OS. Form elements are pretty much controlled by the OS, and so not all styling will be available to all users.

Sorry!

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
IE/FF on Windows will do if you have a workaround?
 
A "workaround" is to make a faux ("fake") dropdown with divs. Then you could style the items however you want.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top