Change option look.


A question:
How to use something like this using not the font color but the font-family??

<SELECT NAME="FontColor">
<OPTION VALUE="Aqua" style="color: Aqua;">Aqua</OPTION>
<OPTION VALUE="Black" style="color: Black;">Black</OPTION>
<OPTION VALUE="Blue" style="color: Blue;">Blue</OPTION>

Here the option value changes to the color set in the style value!

I want to use something like:
<OPTION VALUE="Arial" style="family: Arial;">Arial</OPTION>

I tried this but I would not work??

Can someone help me??

greetings Michel
Who is Participating?
QxmConnect With a Mentor Commented:
try using this:

<select size="1" name="D1" style="font-family: Arial">

If it is possible (and I am not sure it is), what you would need is:

<option value="Blue"><font color="Blue">Blue</font></option>
<option value="Arial"><font face="Arial">Arial</font></option>

Give that a try.

If your style coding above worked, you might also try:

<option value="Arial" style="font-family:Arial"> or "font-face:Arial"  (sorry, I don't remember which syntax is right)

As I said, I am not sure you can do this in any case as part of a select statement.

The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

mmcwAuthor Commented:
Your first answer is not what I need. In my question I already say that that works fine. Your second answer does not work!!
But that is also what I say in my question
BTW, change the name "D1" to your options box name "FontColor"...
mmcwAuthor Commented:
That is not what I want!
I want something like this:

<OPTION VALUE="Arial" style="family: Arial;">Arial</OPTION>
<OPTION VALUE="Courier" style="family: Courier;">Courier</OPTION>
<OPTION VALUE="Comic Sans SM" style="family: Comic Sans SM;">Comic Sans SM</OPTION>

The font style of each option has to change and not for ALL!

As I said in my initial comment, I think the answer to your question is, "You cannot do this".

I assumed from your initial question that the code you specified for changing colors worked (and I indicated this).  I tried it, and it does.  My initial suggestion regarding the color was in case your code was NOT working.

What I initially suggested with regard to the font was that the syntax you were using for the font family was not correct.  The correct syntax is "font-family".  However, that does not seem to work in this instance.


Yep.  Sorry but TTom is correct if that is what you want.  This is an all or none deal...
All Courses

From novice to tech pro — start learning today.