Solved

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

Posted on 2009-03-30
5
523 Views
Last Modified: 2012-06-21
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
Comment
Question by:Angela123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:amazingwolf1
ID: 24016967
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
 
LVL 22

Expert Comment

by:neeraj523
ID: 24016999
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
 
LVL 4

Accepted Solution

by:
amazingwolf1 earned 20 total points
ID: 24017041
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
 
LVL 4

Expert Comment

by:KrisTheComputerGuy
ID: 24017261
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24018266
The CSS does however work in non-IE browsers
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question