How do I bold a <option> tag, or change the color??

Posted on 2004-09-01
Last Modified: 2010-08-05
Hi there I want the else statement option tag to be bolded and/or have a different forecolor or bgcolor, how do I do that?

if RS.Fields("TeacherType") = 1 then
         Response.Write "<option value=" & chr(34) & CStr(RS.Fields(0).Value) & chr(34) & ">" & RS.Fields("LastName").Value & ", " & RS.Fields("FirstName").Value & " - " & RS.Fields("City").Value  & "</option>" & vbLf
        Response.Write "<option value=" & chr(34) & CStr(RS.Fields(0).Value) & chr(34) & ">" & "STA " & RS.Fields("LastName").Value & ", " & RS.Fields("FirstName").Value & " - " & RS.Fields("City").Value & "</option>" & vbLf
         End if
Question by:Gezna
  • 3
LVL 11

Accepted Solution

SweatCoder earned 500 total points
ID: 11954642
try style="bgcolor:red;" or style="color:red;"

insert 1 of the above into the <option> section
LVL 11

Expert Comment

ID: 11954651
but if you're response.writing it, watch out for the quotes. maybe use single quotes instead.
LVL 21

Expert Comment

ID: 11954943
Hi SweatCoder,
 font-weight: bold;

LVL 31

Expert Comment

ID: 11955181
Hi Gezna,

You need to be specific with how you style the select. For instance, you can't bold individual options, only the whole select tag. Font and backgrounds, can however, be individually styled.

See below for an example of each rendition:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">





<form id="myform">
<select class="special">
<option class="green" value="text">Bold and Green Text</option>
<option class="grey" value="text">Bold and Grey Background</option>
<option value="text">Bold Text Only</option>


p.s. Sweat - just a note, it's style="background-color:red;" as opposed to style="bgcolor:red;"
LVL 11

Expert Comment

ID: 11956658
oh yeah. oops.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML code not showing slider block in Magento 2 39
Javascript create file issue 4 60
div to fit another div 8 20
Place text over image using CSS 6 42
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now