What is the use of size attribute in select element | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the use of size attribute in select element

<!DOCTYPE html> <html> <body> <h2>Allow Multiple Seletcions</h2> <p>Use the multiple attribute to allow the user to select more than one value.</p> <form action="/action_page.php"> <select name="cars" size="4" multiple> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="fiat">Fiat</option> <option value="audi">Audi</option> </select> <br><br<select name="cars" size="4" multiple> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="fiat">Fiat</option> <option value="audi">Audi</option> </select>

6th Sep 2018, 11:28 AM
Satyendra Singh
Satyendra Singh - avatar
1 Answer
0
"The size attribute specifies the number of visible options in a drop-down list. If the value of the size attribute is greater than 1, but lower than the total number of options in the list, the browser will add a scroll bar to indicate that there are more options to view." https://www.w3schools.com/tags/att_select_size.asp
6th Sep 2018, 12:25 PM
Janningā­
Janningā­ - avatar