Download our Free HTML Cheat Sheet - Quick Reference for Beginners

Dropdown list code generator

This generator will allow you to create a dropdown list in HTML. Set the options for the list, then generate the code. You can copy and paste the generated code into your webpage, or you can choose to send the generated code to your email. This allows you to create the dropdown list code for later use when using a mobile device.
A dropdown list is typically used within a form to capture a user's selection and process it in some way. The 'value' of the selected item is sent through, and the 'text' is what is seen in the dropdown list.

If you need to create a dropdown menu (a navigation menu that opens on hover/click) instead of a form dropdown, check out our HTML Dropdown Menu Generator.
Example:

Basic options

List Name:
Not seen - only needs to be unique on the page you paste this into (not here). If that page already has an element with this ID, the two will conflict since they'll share styling and scripts.
Behaviour:
Button:
This section allows you to enter the items that will show in the dropdown list. The 'Text shown' is what you will see for each entry; in the example above, this is 'Yahoo' and 'Google'.
Text Shown
Value sent through
Background color:
Padding:
Margin:
Font color:
Font family:

Font size:
Font style:
Width:
px
Leave at 0 if you don't want to set the width
Border style:
Border radius:

Button style

Text on button:
Background color:
Padding:
Margin:
Font color:
Font family:

Font size:
Font style:
Width:
px
Leave at 0 if you don't want to set the width
Cursor:
Border style:
Border radius:

Button hover style

Background color:
Font color:

Code options

Choose how you want the code created
CSS layout:
Unsure? Leave it inline

Frequently asked questions

What's the difference between the "value" and the "text shown"?

The text is what visitors see and pick from in the list. The value is what actually gets sent when the form is submitted - useful when you want to show something friendly ("Australia") but send something else your script expects ("AU"). Leave the value blank to just send the same text.

How do I let people select more than one item?

Choose "Allow multiple selection" under Behaviour. Visitors then hold Ctrl (or Cmd on Mac) while clicking to select several items at once - set how many rows should show at a time with the "number of items to show" field.

Should I add a button or leave it as just the dropdown?

Add a button if the dropdown needs to trigger an action by itself (like jumping to a page). Skip the button if the dropdown is one field inside a bigger form that already has its own submit button.

Inline, stylesheet or in-page style - which should I choose?

Inline is simplest for a one-off dropdown - the styling lives directly on the tag. Stylesheet is better if you're adding several styled elements to a site and want the CSS kept separately. In-page puts the CSS in a <style> block in the page's <head> - a middle ground when you can't edit an external stylesheet.