• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Html » Tutorial » HTML Drop Down Menu
Next →
← Prev

HTML Drop Down Menu

By Dinesh Thakur

A pull down menu lets the user select one choice out of many possible choices. One nice aspect of pull-down menus is that all choices do not have to be seen on the screen and are normally hidden. They occupy minimal amount of space as it displays only on item of the list. In this kind of input field you use <SELECT>instead of <INPUT> and it has a closing tag.

Syntax: 
<SELECT name = "text-id" size="n" multiple > 
<OPTION Value = "Choice-id" selected> Text Label -1 </OPTION> 
................... 
................... 
<OPTION Value = "Choice id m" selected> TEXT LABEL. - m </OPTION> 
</SELECT> 

Name: To establish a name for the select field and is used for form processing.

Size: The number of options you want to show in the window. By default its value is one, specifying size value greater than one turns the pull down list into a scrolling list. In the SELECT field, by default, the user can select only one field.

Multiple: To set the SELECT field to accept any number of options. To select multiple options press ctrl key and click on the options.

<OPTION> Tag: To include the list items. For each list item there must be an <option> tag “The closing” tag is optional.

Value: Whenever a form is submitted, the options in the pull down list are passed to the form handles using the “Value” attribute. If the “Value” attribute is omitted the contents of the option are used instead.

Selected: This attribute is used to specify the default other than the first option. More than the first option- More than one option can be made default by using this attribute but in that case you just include the multiple attribute, otherwise the last option having selected attribute will be considered as default. The defaults will appear when the form is loaded or reset. The following lines of code will add a pull down list to our sample form.

<html> 
<head><title> text fields</title></head> 
<body bgcolor="pink"> 
<p align ="center"><b>admission form</b> 
<form> 
<p> 
<input type ="text" name="name" value="enter your name:" size="25" maxlength="30"> name<br><br> 
<input type ="password" name="passwd" size="25" maxlength="30"><br><br> 
<input type ="text" name="address" size="25" maxlength="30"> address<br><br> 
<input type="radio" name="sex" value="male" checked>male<br> 
<input type="radio" name="sex" value="female" >female<br> 
<select name ="country"> 
<option value = "india">india 
<option value = "america"> america 
<option value = "australia"> australia 
<option value = "new zealand"> new zealand 
<option value = "china"> china 
</select><b>country</b> 
</form> 
</body> 
</html> 

But if the “multiple” attribute is included, the list will become a scrolling list. This attribute is added in the <SELECT> tag as shown below:

<SELECT NAME="COUNTRY" MULTIPLE>  
  <OPTION VALUE="INDIA">INDIA  
  <OPTION VALUE=" AMERICA" SELECTED>AMERICA  
  <OPTION VALUE="AUSTRALIA">AUSTRALIA  
  <OPTION VALUE="NEW ZEALAND">NEW ZEALAND  
  <OPTION VALUE="CHINA">CHINA  
</SELECT><B>COUNTRY</B> 

You’ll also like:

  1. SQL DROP INDEX
  2. SQL DROP TABLE Statement
  3. What is HTML?
  4. Html Center
  5. Html Address
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

HTML Tutorials

HTML Tutorials

  • HTML - Home
  • HTML - History
  • HTML - Lists
  • HTML - Unordered List
  • HTML - Ordered Lists
  • HTML - Frame Tag
  • HTML - Input Type
  • HTML - Input Type="File"
  • HTML - Input Type="Hidden"
  • HTML - Form Tag
  • HTML - Img Tag
  • HTML - Anchor Tag
  • HTML - Table Tag
  • HTML - Span Tag
  • HTML - Button Tag
  • HTML - Doctype
  • HTML - Fieldset Tag
  • HTML - Links Tag
  • HTML - Drop Down Menu
  • HTML - Accesskey
  • HTML - Cgi
  • HTML - Post Method
  • HTML - Background Image
  • HTML - Text Area
  • HTML - TabIndex
  • HTML - Align Center
  • HTML - Address Tag
  • HTML - Thumbnails
  • HTML - Marquee Tag
  • HTML - Line Break
  • HTML - Blockquote
  • HTML - HR Tag
  • HTML - Image Center
  • HTML - Center Text
  • HTML - Link CSS
  • HTML - Html Vs Html5

Other Links

  • HTML - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW