How can I change the font-size of a select option?

user1128331

I am trying to style a select option dropdown list. Is it possible to make the font-sizes of the options different from the default value? For example, the default:

-- Select Country --  

Would be size 7pt; and one of the options,

Georgia

Would be size 13pt.

This is my dropdown list:

.select_join {
  width: 170px;
  height: 28px;
  overflow: hidden;
  background: url('http://s24.postimg.org/lyhytocf5/dropdown.png') no-repeat right #FEFEFE;
  border: #FEFEFE 1px solid;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  -webkit-box-shadow: inset 0px 0px 10px 1px #FEFEFE;
  box-shadow: inset 0px 0px 10px 1px #FEFEFE;
}
.select_join select {
  background: transparent;
  width: 170px;
  font-size:7pt;
  color:grey;
  border: 0;
  border-radius: 0;
  height: 28px;
  -webkit-appearance: none;
}
.select_join select:focus {
  outline: none;
}
<div style="background-color:pink;height:150px; text-align:center;">
  <br/>
  <div class="select_join" style="margin-left:15px">
    <select name="txtCountry">
      <option>-- Select Country --</option>
      <option value="1">Georgia</option>
      <option value="2">Afghanistan</option>
    </select>
  </div>
</div>

See also my demo on JSFiddle.

Unfortunately, it works only on Firefox. Could it be that others browser don't support styling of <option> elements?

Browsers I tested on:

  • Chrome: Version 27.0.1453.116 m
  • IE: 10
  • Firefox: 22.0
Atropo

Add a CSS class to the <option> tag to style it: http://jsfiddle.net/Ahreu/

Currently WebKit browsers don't support this behavior, as it's undefined by the spec. Take a look at this: How to style a select tag's option element?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to change font size of the first option tag in a dropdown menu (select)?

From Dev

How can I change the size of the Dash font?

From Dev

How can I change the size of the Dash font?

From Dev

How can I change the cmd font and font size with a command?

From Dev

How can I change the font size of a Gtk.Label in vala?

From Dev

How can I change font size in Eclipse for ALL text editors?

From Dev

How can I change the font size using seaborn FacetGrid?

From Dev

How can I change the font size of a row dynamically with datatables?

From Dev

How can I change the default font size of a XRRichText?

From Dev

How can i change in TabControl the font size of a tab title?

From Dev

How can I change the subtitles font size in VLC Media Player?

From Dev

How can I change the font size of KDE menus and dialogs...?

From Dev

How can I change lxpanel digital clock font size?

From Dev

How can I set/change the font size of UIBarButtonItem's Title

From Dev

How can I change the system font size in OS X?

From Dev

Shiny - how to change the font size in select tags?

From Dev

How can I open bootstrap modal on select box option change?

From Dev

How can I change the font size in a text view, but not the font style? (light vs. regular) - Swift

From Dev

How can I change the font size in a text view, but not the font style? (light vs. regular) - Swift

From Dev

How do i change the font size of JPanel

From Dev

How do I change the font size in TeraTerm?

From Dev

How to get the accessibility font size for iOS and Android in Xamarin.Forms so I can change font-size in a HTML WebView?

From Dev

How do I change the font or the font size in the TTY (console)?

From Dev

How do I change the font or the font size in the TTY (console)?

From Dev

How can I increase the font size in WebStorm?

From Dev

How can i configure font size in gitk?

From Dev

How to change font color of the option select of specific divs?

From Dev

how to change the font size?

From Dev

How do I change UILabel size depending on its font size?

Related Related

  1. 1

    How to change font size of the first option tag in a dropdown menu (select)?

  2. 2

    How can I change the size of the Dash font?

  3. 3

    How can I change the size of the Dash font?

  4. 4

    How can I change the cmd font and font size with a command?

  5. 5

    How can I change the font size of a Gtk.Label in vala?

  6. 6

    How can I change font size in Eclipse for ALL text editors?

  7. 7

    How can I change the font size using seaborn FacetGrid?

  8. 8

    How can I change the font size of a row dynamically with datatables?

  9. 9

    How can I change the default font size of a XRRichText?

  10. 10

    How can i change in TabControl the font size of a tab title?

  11. 11

    How can I change the subtitles font size in VLC Media Player?

  12. 12

    How can I change the font size of KDE menus and dialogs...?

  13. 13

    How can I change lxpanel digital clock font size?

  14. 14

    How can I set/change the font size of UIBarButtonItem's Title

  15. 15

    How can I change the system font size in OS X?

  16. 16

    Shiny - how to change the font size in select tags?

  17. 17

    How can I open bootstrap modal on select box option change?

  18. 18

    How can I change the font size in a text view, but not the font style? (light vs. regular) - Swift

  19. 19

    How can I change the font size in a text view, but not the font style? (light vs. regular) - Swift

  20. 20

    How do i change the font size of JPanel

  21. 21

    How do I change the font size in TeraTerm?

  22. 22

    How to get the accessibility font size for iOS and Android in Xamarin.Forms so I can change font-size in a HTML WebView?

  23. 23

    How do I change the font or the font size in the TTY (console)?

  24. 24

    How do I change the font or the font size in the TTY (console)?

  25. 25

    How can I increase the font size in WebStorm?

  26. 26

    How can i configure font size in gitk?

  27. 27

    How to change font color of the option select of specific divs?

  28. 28

    how to change the font size?

  29. 29

    How do I change UILabel size depending on its font size?

HotTag

Archive