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, 2022 in HTML by Deepak
• 980 points
676 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, 2022 in HTML by Ashwini
• 5,430 points
567 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, 2022 in HTML by Ashwini
• 5,430 points
1,416 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, 2022 in HTML by Ashwini
• 5,430 points
1,292 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, 2022 in HTML by Tejashwini
• 3,820 points
1,376 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, 2022 in HTML by Ashwini
• 5,430 points
487 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, 2022 in HTML by Deepak
• 980 points
719 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, 2022 in CSS by Edureka
• 12,690 points
591 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
10,361 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,250 points
2,795 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,360 points
850 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP