Affiliate link

HTML - Select

HTML Select is a drop-down list display list of options that can be selected.

HTML Select - Basic

<select>
    <option>HTML5</button>
    <option>CSS3</button>
    <option>JavaScript</button>
</select>

Code result

HTML Select - Default selected

<select>
    <option selected>HTML5</button>
    <option>CSS3</button>
    <option>JavaScript</button>
</select>

Code result

HTML Select - Multiple Selections

Define multiple attribute to allow multiple selections. Use size attribute to define the number of rows to display.

<select size="5" multiple>
    <option>HTML5</button>
    <option>CSS3</button>
    <option>JavaScript</button>
</select>

Code result

HTML Select - Placeholder

select does not support placeholder. You have to use CSS to display a placeholder.

<style>
    select:required:invalid {
        color: gray;
    }
    option[value=""][disabled] {
        display: none;
    }
    option {
        color: black;
    }
</style>
<select>
    <option value="" disabled selected>Select programming language</option>
    <option>HTML5</button>
    <option>CSS3</button>
    <option>JavaScript</button>
</select>

Code result

Affiliate link
Affiliate link
Affiliate link
Advertisment
Fiverr
Ad - SiteGround WooCommerce hosting - best home for your online store. Fast WooCommerce, Free SSL, Top support. Learn more.