How to work with Dropdown list in HTML

In this article we will discuss about the creation of dropdownlist in HTML.
  • 1914

We can also create a dropdown list in HTML. In order to create the dropdown list in HTML document we have to use <select> tag and also to include the option in it to be selected we have to use <option> tag under <select> tag. The most important attribute of <option> tag is value attribute.

<html>
<
head>dropdown list in html</head>
<
body bgcolor="yellow">
    <form>
    <select>
        <option value="red">Red</option>
        <option value="green">green</option>
        <option value="yellow">Yellow</option>
        <option value="orange">Orange</option>
        <option value="brown">Brown</option>
        <option value="Pink">Pink</option>
        <option value="blue">Blue</option>
    </select>
    </form
>

</
html>


Ouput

sssssssssssssssssssssssssssssssss.jpg

Here a dropdown list has been created and also we have apply backgroud color yellow of the web page by using bgcolor property in body tag. Dropdownlist is an part of the form so for it we have to use <form> tag as well. It is clear from the above example.

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.