- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML list Attribute
The HTML list attribute refers to a <datalist> element that contains pre-defined options for an <input> element in an HTML document.
Syntax
Following is the syntax −
<input list=”text”>
Let us see an example of HTML list Attribute:
Example
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%); text-align: center; } input { display: block; width: 60%; margin: 1rem auto; } </style> <body> <h1>HTML list Attribute Demo</h1> <input list="subject" placeholder='Select your elective subject'> <datalist id='subject'> <option>Maths</option> <option>Physics</option> <option>Economics</option> </datalist> </body> </html>
Output
Advertisements