HTML Select Option, text formatting

There is currently no support for nested HTML tags within options. The closest formatting element you can use is <optgroup> which will group options into sections.

What you could do is use a javascript replacement like Select2 or Chosen to style the elements. It isn't native, but it does support HTML.


The answer is no.

As you can see on MDN:

Permitted content: Text with eventually escaped characters (like &eacute;).

There are alternatives combining other tags, but not select and option.


For further reading:

  • Select boxes with HTML inside each option.

  • jQuery .customSelect()

  • A custom select for @twitter bootstrap using button dropdown.


As the specification "4.10.12 The option element" states is the content model of an <option>-element text only.

Tags:

Html