Home > Web Front-end > HTML Tutorial > How to specify the number of visible options in in HTML?
王林
Release: 2023-08-25 14:21:06
forward
1451 people have browsed it

How to specify the number of visible options in <select> in HTML?

Use the size attribute to set the number of visible options for the

Example

You can try running the following code to implement the size property -

<!DOCTYPE html>
<html>
   <body>
      <p>Select the countries you have visited till now,</p>
      <select size = "5">
         <option value = "india">India</option>
         <option value = "us">US</option>
         <option value = "canada">Canada</option>
         <option value = "aus">Australia</option>
         <option value = "bangladesh">Bangladesh</option>
      </select>
   </body>
</html>
Copy after login

The above is the detailed content of How to specify the number of visible options in