HTML List Box

The list box is a graphical control element in the HTML document that allows a user to select one or more options from the list of options.

Syntax

To create a list box, use the HTML element <select> which contains two attributes Name and Size. The Name attribute is used to define the name for calling the list box, and size attribute is used to specify the numerical value that shows the how many options it contains.

Examples:

Example 1: Consider the below example that creates a simple list box.

Test it Now

Output:

HTML List Box

Example 2: Below example uses the multiple attribute for selecting the multiple options in a list. We can select multiple options from list box by holding the ctrl key.

Test it Now

Output:

HTML List Box




Latest Courses