Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling options in bold in Internet Explorer

I am getting a styling problem with options. I need some options to appear in bold style, but Internet Explorer doesn't want to render it.

I'm setting it using CSS:

font-weight: bold;

Which is not working. An example can be seen in this page:

Example

which shows bold fonts in Firefox but not in Internet Explorer.

I have tried in Internet Explorer 7 and 8.

Has anyone has an alternative?

EDIT: A sample:

HTML:

<select>
    <option class="special">Special</option>
</select>

CSS:

.special {
    font-weight: bold;
}
like image 235
Marcelo Avatar asked Jul 11 '11 19:07

Marcelo


People also ask

How do I make text bold in style?

To bold the text in HTML, use either the strong tag or the b (bold) tag. Browsers will bold the text inside both of these tags the same, but the strong tag indicates that the text is of particular importance or urgency. You can also bold text with the CSS font-weight property set to “bold.”

How do I change the font in Internet Explorer?

Change the font, formatting, and colors on pagesOpen Internet Explorer, select the Tools button and select Internet options. Select the General tab, and then, under Appearance, select Fonts. Select the fonts you want to use, select OK, and then select OK again.

Which property is used to bold the text?

The font-weight CSS property sets the weight (or boldness) of the font.


2 Answers

IE doesn't allow styling of <option> elements independently. This is because IE uses a Windows form control to render the select box, which doesn't support this feature.

(as an aside, this is the same reason that IE's select boxes can have issues with layering when you put them behind other objects; the form control is being rendered by the Windows OS, not by the browser, so the browser has less control over it than most other elements on the page)

Other modern browsers do allow you to do it, as they render their own select boxes rather than deferring to the OS.

like image 52
Spudley Avatar answered Sep 28 '22 04:09

Spudley


in IE, you can't style an option. I had the same issue...you can give it color but not much else.

You could write a jquery plugin or find an existing one to "convert" your select to a styled list/dropdown.

Also see: Create a styled Dropdown like on jquery UI

like image 21
Matt Avatar answered Sep 28 '22 05:09

Matt