Formatting text elements of <option> tags

Does anyone know of any way to italicize the text of an option tag? Specifically, I'm trying to italicize some entries in a select menu while leaving others alone. I have already attempted a few variations on the following with no success:<br />
<br />
<select name="mySelectMenu"><br />
<br />
<option> Blue pencils </option><br />
<option><i>Red pencils</i> </option><br />
<option><i>Green pencils</i></option><br />
<option> Yellow pencils </option><br />
<br />
</select><br />
<br />
<br />
The desired result would be that only the 2nd and 3rd options in the dropdown menu would be italicized.<br />
<br />
Many thanks for any help provided...<!--content-->you will need to set the style for the <br />
select tag and it will reflect on options.<!--content-->Originally posted by Khalid Ali <br />
you will need to set the style for the select tagYou could style the <select> element, however, the original poster implies that they want only specific options to be displayed as italic, and thus you must style the <option> element instead because styling <select> would result in all options becoming styled. All you'd need is:<select><br />
<option value="foo">bar</option><br />
<option value="foo" class="i">bar</option><br />
<option value="foo" class="i">bar</option><br />
<option value="foo">bar</option><br />
</select>Along with the following CSS:<style type="text/css"><br />
/*<![CDATA[*/<br />
.i { font-style: italic; }<br />
/*]]>*/<br />
</style><!--content-->You might want to check this (<!-- m --><a class="postlink" href="http://blab-n-lab.home.comcast.net/lab/styletest.html">http://blab-n-lab.home.comcast.net/lab/styletest.html</a><!-- m -->) out as an example. IE's support of the widget styles is quite pitiful so look at it with Mozilla or Firefox.<!--content-->
 
Back
Top