HTML list 属性
htmlweb developmentfront end technology更新于 2024/5/23 6:36:17
HTML list 属性指的是 HTML 文档中 <input> 元素的预定义选项,即 <datalist> 元素。
语法
以下是语法 −
<input list=”text”>
让我们看一个 HTML list 属性的示例:
示例
<!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>
输出

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

