HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <select> tag

The HTML <select> element represents a drop-down list that provides a menu of options.

The <option> tags inside the <select> element define the available options in the list.

Run code

Browser compatibility

The <select> element is fully supported by all browsers:

<select> yes yes yes yes yes


The following table shows the attributes that are specific to the <select> tag:

HTML5 is new in HTML5

Attribute Value Description
autofocus - Specifies that on page load the drop-down list should automatically get focus
disabled - Indicates that the user cannot interact with the drop-down list
form id Specify the form element to which the select element is associated (that is, its "form owner")
multiple - Indicates that multiple options can be selected in the list
name text Specify the name of the control
required - Before submitting the form the user is required to select a value, else it won't proceed ahead
size number Defines the number of visible items in the drop-down list

Global Attributes

The <select> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <select> tag supports the event attributes described in HTML Events Reference

Styling with CSS

The <select> element is notoriously difficult to style productively with CSS. You can affect certain aspects like any element — for example, manipulating the box model, the displayed font, etc.,

If you want to get full control, you should consider using a library with good facilities for styling form widgets (such as jQuery UI), or try rolling your own dropdown menu using non-semantic elements and JavaScript to provide semantics.

Last updated: Friday 28 Sep, 2018