Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT box formatting??

Status
Not open for further replies.

parkers

Vendor
Oct 21, 2002
157
GB
Hi,

Does anyone know if its possible using CSS or otherwise to have formatted text in a select box? By formatted I mean specific text within an option tag is highlighted in bold or different colour.

Any help provided would be appreciated.

Thanks,
SP

 
try:
Code:
   <option style=&quot;color: red; font-weight: bold;&quot;>This will be red and bold.</option>


________________________________________
[hippy]Roger J Coult; Grimsby, UK
In the game of life the dice have an odd number of sides.
 
Hi,

Thanks for the quick response ... I'll clarify the requirements a little ...

Ideally I would like to have specific text in bold and another part of the text in coloured font ...

e.g. if this worked ...

<option>
<font color=red>This is RED</font>
<b>This is BOLD</b>
</option>

I know the above doesn't work so was wondering if there is an alternate way to achieve this.

Thanks,
SP
 
Hmmm...

My mistake. I've tried a few things but can't seem to get what you want to work... lloks like the OPTION tag just ignores embedded HTML tags (need to look at the SGML for OPTION to see if this is what is should do; but I suspect this is entirely proper).

________________________________________
[hippy]Roger J Coult; Grimsby, UK
In the game of life the dice have an odd number of sides.
 
Hello!

You cannot set the &quot;bold&quot; property on the option level. However, you can set the background color, and the font color like this:

Code:
  <SELECT STYLE=&quot;font-family: Arial; font-size: 7pt;&quot; NAME=&quot;hejhej&quot;>
    <OPTION STYLE=&quot;background-color: red; color: white;&quot;>0</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>1</OPTION>
    <OPTION SELECTED>2</OPTION>
    <OPTION>3</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>4</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>5</OPTION>
    <OPTION STYLE=&quot;background-color: red; color: white>6</OPTION>
    <OPTION STYLE=&quot;background-color: red; color: white>7</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>8</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>9</OPTION>
    <OPTION>10</OPTION>
    <OPTION>11</OPTION>
    <OPTION>3 (Tre)</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>4</OPTION>
    <OPTION STYLE=&quot;background-color: beige;&quot;>5</OPTION>
    <OPTION>6</OPTION>
    <OPTION>7</OPTION>
  </SELECT>

Hope it helped!

/Sebastian.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top