Register  |  Login

Question Details    

   Question

Time: 04:02 - Sep 26, 2007     Asked by: john2      Status: Answered      Points: 125   

How do I change the font color for an option within a SELECT tag in HTML?

I am creating a list in a select tag and I want to change the font for the text which will be displayed within the options, just for one option. Is there a way to accomplish this?

Example:

<select multiple size='5'>
<option>Text
<option>Text
<option>Text <------ I want to change the color of that text
<option>Text
<option>Text
</select>

Ask a New Question

Become a Quomon Expert

Current Categories

 

Similar Questions


   

Answer Discussion
Answer Discussion
Answer Summaries
Answer Summary
 
John,

It looks like you can do this a couple of different ways. Check out the code sample below:

<html>
<head>
 <style>
  .red
  {
   color: red;
   font-size: 2em;
  }
 </style>
</head>
<body>
 <select multiple size='5'>
  <option>Text 1</option>
  <option>Text 2</option>
  <option class="red">Text 3</option>
  <option>Text 4</option>
  <option style="color: blue; font-weight: bold;">Text 5</option>
 </select>
</body>
</html>

Let me know if this helps... 

Expert:

rcastagna

Date:

Oct 10, 2007

Time:

07:22

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Castagna...You are a genius. It worked great.

J

Expert:

john2

Date:

Oct 10, 2007

Time:

07:27

 

Votes: Good (0) | Bad (0)
Login to rate this answer

what if i just want to change the color of '4' in this option <option>Text 4</option>
can anyone please suggest ?

Expert:

sivarampratapa

Date:

Apr 30, 2008

Time:

16:04

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Question Answered

This question has been answered, and points have been rewarded to the following experts:

rcastagna: 125

You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.

 
No summaries have been submitted yet. Want to be the first?



Respond to this question:

New User

  Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:


Forgotten Password

 

New User

  Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:


Forgotten Password

   

"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it


All Questions


Language Options

English:

www.quomon.com

Español:

www.quomon.es

Sponsors

Questions and Answers Software
Real Estate Postcards
Marketing Fulfillment