Solved

Option Font-Family/Font-Face

Posted on 2004-04-13
11
1,286 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now