?
Solved

Option Font-Family/Font-Face

Posted on 2004-04-13
11
Medium Priority
?
1,296 Views
Last Modified: 2013-12-03
Hi-
   How do you change the font-family/font-face of a simgle option? I tried putting this in the option tag:

style="font-family:Wingdings"

but that doesn't work. Neither does it work with font-face. I need this for one option, no the whole select menu. It is a multiple-select menu, if that matters.

-IceMetalPunk
0
Comment
Question by:IceMetalPunk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 6

Expert Comment

by:Andy
ID: 10819207
The font-family style does not apply to options only the whole menu.
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 1000 total points
ID: 10819354
...that's all there is - the styling must be on the select element:
<select size="3" style="font-family:georgia;">

If you can handle a custom select box built from DHTML, then you have many more options:
http://webfx.eae.net/dhtml/select/jsGenerated.html
0
 
LVL 3

Expert Comment

by:azcn2503
ID: 10824958
I don't think it's possible to change the font family of a single option. However, I do know that the background colour can be changed, like so:
<option style="background-color:#f00;">Red</option>
<option style="background-color:#ff0;">Yellow</option>
Maybe it will be supported in future browsers.
0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10828218
The only options you have directly on the options are color and background-color.  The only thing you can with font is put the option in an optgroup, and then the label of the optgroup will be italics:

<option> one</option>
<option> two</option>
<optgroup label="more">
 <option> three</option>
</optgroup>
<option> etc...</option>


Cd&
0
 
LVL 6

Assisted Solution

by:Lord_McFly
Lord_McFly earned 1000 total points
ID: 10848872
I'm not sure exactly what it is you are trying to do - I'm guessing you have a list of characters in the multi-select list and need to apply a font to see how the characters change. As mentioned above its not possible to change each option individually.

What I done in my example is have an font list above the multi-select which when you select the font changes the font style of the multi-select list so you can see how those characters would look and once a font has been selected you'll be able to use the down arrow and basically scroll and view the effect it has on your multi-select list - if you get what I mean.

Cop and paste - have a quick look...

<html>
<head>
<title>Fonts</title>
<script language="JavaScript">
<!--
function ChangeFont(Object,FormItem)
      {
            document.getElementById(FormItem).style.fontFamily=Object.options[Object.selectedIndex].value;
      }
//-->
</script>
</head>
<body>
<form name="Tags" method="post" action="Tags.htm">
      <select name="f_0" onChange="ChangeFont(this,'f_1')" style="WIDTH: 100">
            <option value="">Select Font</option>
            <option value="Verdana">Verdana</option>
            <option value="Ariall">Ariall</option>
            <option value="WebDings">WebDings</option>
      </select><br>
      <select name="f_1" multiple style="WIDTH: 100">
            <option value="1">A</option>
            <option value="2">B</option>
            <option value="3">C</option>
      </select>
</form>
</body>
</html>
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10885478
Do you need any more assistance on this question?
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10933930
Describe a little more about what you are trying to do - maybe there is an alternative we could suggest.
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10950345
*** Misplaced comment deleted ***
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10950358
Sorry - wrong place :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question