HighDots Forums  

Setting Style for Select > Option

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Setting Style for Select > Option in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jason Carlton
 
Posts: n/a

Default Setting Style for Select > Option - 02-04-2008 , 11:20 PM






Is there a way to change the font-family and font-size for each
individual option in a select menu? Something along the lines of:

<select size="1">
<option style="font-family: Arial; font-size: 8px">One</option>
<option style="font-family: Tahoma; font-size: 10px">Two</option>
<option style="font-family: Verdana; font-size: 12px">Three</option>
</select>

I see that I can change the color using style="color: whatever", but
none of the other attributes change this way.

TIA,

Jason

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Setting Style for Select > Option - 02-05-2008 , 02:22 AM






Scripsit Jason Carlton:

Quote:
Is there a way to change the font-family and font-size for each
individual option in a select menu?
Yes, of course. And, of course, usual CSS Caveats apply.

Quote:
select size="1"
option style="font-family: Arial; font-size: 8px">One</option
option style="font-family: Tahoma; font-size: 10px">Two</option
option style="font-family: Verdana; font-size: 12px">Three</option
/select
Of course, that's absurd, but so (though maybe less obviously) is almost
any idea of setting font family or size different in different options.

Quote:
I see that I can change the color using style="color: whatever", but
none of the other attributes change this way.
Oh, it's just item #2 in the usual CSS Caveats:

"Not all browsers support CSS.
Not all browser versions support CSS to the same extent.
Not all users will have enabled CSS in CSS enabled browsers.
Some users of NN may have disabled Javascript, thus disabling CSS.
Some users may have enabled their own stylesheets, disabling yours.
CSS2 and CSS-P are moving targets. Use with care.
Font specification is problematic.
Unusual caveats may apply. ;-) "

http://www.dev-archive.net/articles/...S-caveats.html
(mostly ignore the disclaimer; the content, though old, is much more
fresh and meaningful than most of the CSS stuff around)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
Petr Vileta
 
Posts: n/a

Default Re: Setting Style for Select > Option - 02-05-2008 , 08:47 AM



Jason Carlton wrote:
Quote:
Is there a way to change the font-family and font-size for each
individual option in a select menu? Something along the lines of:

select size="1"
option style="font-family: Arial; font-size: 8px">One</option
option style="font-family: Tahoma; font-size: 10px">Two</option
option style="font-family: Verdana; font-size: 12px">Three</option
/select

I see that I can change the color using style="color: whatever", but
none of the other attributes change this way.

You can change background color too but this is circa all what you can do with
<option> tag :-)
I had similar problem as you few month ago and I resolve it by using
scrollable <div> and series of checkboxes. Of course, this is workaround but
work for most used browsers.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>



Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Setting Style for Select > Option - 02-09-2008 , 12:43 PM



Scripsit Jukka K. Korpela:

Quote:
http://www.dev-archive.net/articles/...S-caveats.html
(mostly ignore the disclaimer; the content, though old, is much more
fresh and meaningful than most of the CSS stuff around)
I decided to write a modernized and somewhat expanded version of the CSS
Caveats:
http://www.cs.tut.fi/~jkorpela/css-caveats.html

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.