How to style the option of an html select element

0 votes

Here's my HTML:

<select id="ddlProducts" name="ddProducts"> 
    <option>Product1 : Electronics </option>
    <option>Product2 : Sports </option>
</select>

Using CSS only, I want to make the product name (i.e. 'Product1', 'Product2', etc.) bold, and its categories (i.e. Electronics, Sports, etc.) italicized. I discovered an old question that stated it was not possible to use HTML and CSS, but hopefully, there is now a solution.

Aug 17 in HTML by Deepak
• 940 points
26 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
0 answers

How can I set the default value for an HTML <select> element?

I believed that by setting the "value" ...READ MORE

Jul 26 in HTML by Ashwini
• 1,160 points
50 views
0 votes
0 answers

How to change the style of the title attribute inside an anchor tag?

Example: <a href="example.com" title="My site"> Link </a> How do ...READ MORE

Aug 1 in HTML by Ashwini
• 1,160 points
121 views
0 votes
0 answers

How to GET background color of a particular portion on the html page

I used Gradient to set the color ...READ MORE

Jul 26 in HTML by Ashwini
• 1,160 points
33 views
0 votes
0 answers

How to rename HTML "browse" button of an input type=file?

How can the browse button be changed ...READ MORE

Jul 27 in HTML by Tejashwini
• 1,960 points
69 views
0 votes
0 answers

How to add/update an attribute to an HTML element using JavaScript?

I'm looking for a JavaScript method to ...READ MORE

Aug 1 in HTML by Ashwini
• 1,160 points
34 views
0 votes
1 answer

How to add/update an attribute to an HTML element using JavaScript?

You can read here about the behaviour of attributes ...READ MORE

answered Aug 4 in HTML by Deepak
• 940 points
26 views
0 votes
1 answer

I am not able to create CSS Dropdown menu

Use any element to open the dropdown ...READ MORE

answered Jun 28 in CSS by Edureka
• 9,540 points
75 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
5,020 views
0 votes
1 answer

Using/Handling colon inside a JSF generated HTML element ID in CSS selector

Yes, you can.  Just Backslash (\) the colon.  Like ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,240 points
1,730 views
0 votes
1 answer

What is a css selector and where is it used?

CSS Selector is a combination of element ...READ MORE

answered Nov 21, 2018 in Data Analytics by Kalgi
• 52,350 points
295 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP