Horje
How to Visible HTML Select Option Values

Use the size attribute to specify the number of visible values:


Simple Example of Visible HTML Select Option Values

Example: HTML
 <label for="cars">Choose a car:</label>
<select id="cars" name="cars" size="3">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select> 

Full Example of Visible HTML Select Option Values

Visible Option Values Use the size attribute to specify the number of visible values.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h2>Visible Option Values</h2>

<p>Use the size attribute to specify the number of visible values.</p>

<form action="/action_page.php">
  <label for="cars">Choose a car:</label>
  <select id="cars" name="cars" size="3">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="fiat">Fiat</option>
    <option value="audi">Audi</option>
  </select><br><br>
  <input type="submit">
</form>

</body>
</html>

Output should be:

Full Example of Visible HTML Select Option Values





Related Articles
What is HTML Form Elements HTML Form Elements
How to create HTML <input> Element HTML Form Elements
How to create The <label> Element HTML Form Elements
How to create HTML <select> Element HTML Form Elements
How to create HTML <option> element HTML Form Elements
How to Visible HTML Select Option Values HTML Form Elements
How to Allow Multiple Selection in HTML Option Value HTML Form Elements
How to create HTML <textarea> Element HTML Form Elements
How to create HTML <button> Element HTML Form Elements
How to create HTML <fieldset> and <legend> Elements HTML Form Elements
How to create HTML <datalist> Element HTML Form Elements
How to create HTML <output> Element HTML Form Elements

Single Articles
Simple Example of Visible HTML Select Option ValuesHTML Form Elements
Full Example of Visible HTML Select Option ValuesHTML Form Elements

Read Full:
HTML Form Elements
Category:
Web Tutorial
Sub Category:
HTML Form Elements
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
69


Reffered: https://www.w3schools.com/html/html_form_elements.asp

Share on: