Forum Moderators: open

Message Too Old, No Replies

Changing font in dropdown boxes

         

corkhopper

2:34 pm on Dec 5, 2008 (gmt 0)

10+ Year Member



Hi

Not sure I'm in the right part of the forum.

I need to change the individual options in a drop down box to different fonts. I run a greetings card company and wish to offer my customers the option of different fonts and want the options to reflect the font choice. I need to be able to change or add fonts at will and there may be different choices for different cards on the same page, so I need to be able to add coding to each dropdown box. Is this possible?

Thanks in advance!

phranque

6:52 am on Dec 8, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], corkhopper!

you could apply a font with an inline style using thr style attribute of the option tag, or you could assign a unique id to each option tag with the id attribute and use css to assign a font to each id.

Trace

2:57 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



You're very restricted when it comes to styling options in a select box.

CSS

<style type="text/css">
.arial{ font-family:Arial; background-color:#3399CC}
.Verdana{ font-family:Verdana; background-color:#66CC99}
.cgothic{ font-family:Century Gothic; background-color:#FFFF99}
.trebuchet{ font-family:Trebuchet MS; background-color:#CC99FF}
</style>

HTML

<select name="txtSelect">
<option value="1" class="arial">Arial
<option value="2" class="verdana">Verdana
<option value="3" class="cgothic">Century Gothic
<option value="3" class="trebuchet">Trebuchet MS
</select>

Try it yourself, you will notice that this only partially works with Internet Explorer.