• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

How do you make an item on a drop down list bold?

I have tried using <b> and <em> tags and I still can't get parts of my drop down list to go bold.  Is this possible to do?

<option value="/abc/">Test Page</option>
0
Angela123
Asked:
Angela123
1 Solution
 
amazingwolf1Commented:
Hi,
You can't do that in the basic SELECT element.
If you want that functionality, you must implement your own drop down, either in JS or in C#. If you do this with JS I recommend using JQuery which would save you some effort doing that.

Hope this helped!
0
 
neeraj523Commented:
hello

here you go..
<select SIZE="1" NAME="ListBoxURL">
	<option value="1">One</option>
	<option style="font-weight: bold;" value="2">Two</option>
	<option value="3">Three</option>
	<option value="4">Four</option>
</select>

Open in new window

0
 
amazingwolf1Commented:
neeraj523, your example doesnt work.

Angela123 - see MSDN documentation about the option element. It does not have an option to set the font property like you need it:

http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx#

So I think my response above gave you a direction where to start.

0
 
KrisTheComputerGuyCommented:
You change the font styling for the select box as a whole, but styling for individual options ignored. I suggest focusing on why you want certain options bolded and finding a another way to make that happen. For now I'm going to assume the point of bolding is to suggest one or more options as the better choice(s).

One solution could be to simply designate one option as "selected" when the page loads.  

<option selected value="2">Two</option>


Another solution may involve differentiating objects in the select is by adding a unique like symbol (like * &/or **) to the end of the text for the option item. Then place a description for that symbol at the bottom of the page.

<option value="2">Two **</option>

Later...
**<i> Option Two is suggested for such & such reason</i>


Hope that helps

0
 
Michel PlungjanIT ExpertCommented:
The CSS does however work in non-IE browsers
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now