Solved

Option Font-Family/Font-Face

Posted on 2004-04-13
11
1,291 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
11 Comments
 
LVL 6

Expert Comment

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

Accepted Solution

by:
seanpowell earned 250 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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 250 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS: Making responsive table look nicer 7 31
html Uncheck Checkbox 2 25
Asp in script 6 39
Fix Form size HTML 16 15
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

832 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