宝宝热疹用什么药膏| 成王败寇什么意思| 排湿气最快的方法吃什么| 史诗级什么意思| 助听器什么价位| 余事勿取 什么意思| poppy什么意思| 医院去痣挂什么科| oppo最新款是什么型号| 冬至节气的含义是什么| 千年杀是什么| 小孩尿酸高是什么原因| 爱困总想睡觉什么原因| 绿茶属于什么茶| 鱼油什么牌子好| 两小无猜是什么生肖| 单数是什么| 心脏主要由什么组织构成| 屎特别臭是什么原因| psv是什么| 死不瞑目是什么意思| 腰肌劳损需要注意什么| 一只眼皮肿是什么原因| 总是感觉有尿意是什么原因| 子婴是秦始皇什么人| 排湿气最快的方法吃什么| 内科检查什么| 劫伤是什么意思| 冬是什么生肖| m和s是什么意思| 消化不良吃什么药最好| 农历五月初五是什么节| 天狼星在什么位置| 膀胱炎有什么症状| 多吃什么对肾好| 解压密码是什么| 母亲节买什么礼物| 女生被口是什么感觉| 吃什么能排湿气| 螺蛳粉为什么那么臭| 静脉曲张什么症状| 靶身高是什么意思| 男人阴茎硬不起来是什么原因| 核医学科主要治什么病| 下午3点到5点是什么时辰| 喉咙里痰多是什么原因| 春天能干什么| 什么是韧性| 什么是平年什么是闰年| 吃什么补孕酮| 昆仑山在什么地方| 电视剧靠什么赚钱| 白玫瑰花语是什么意思| 88年的龙是什么命| 五行火生什么克什么| 肝经不通吃什么中成药| 蒲公英的种子像什么| 小三阳是什么| 祀是什么意思| 腺样体肥大是什么意思| 蓝什么什么| 眼角发黄是什么原因| 二百五是什么意思| ellesse是什么牌子| 李小龙和丁佩什么关系| 口臭看什么科| 德国是什么人种| 宝宝蛋白质过敏喝什么奶粉| 什么时候放假| 可颂是什么意思| 什么是证件照| 动土破土是什么意思| 上海市市委书记是什么级别| 豆腐吃多了有什么坏处| 牙龈为什么会萎缩| 为什么早射| 芒种可以种什么菜| 产后抑郁症有什么表现症状| 肛裂涂什么药膏能愈合| 董酒是什么香型| 什么是风象星座| 情趣内衣是什么意思| 阴间到底是什么| 沉香有什么好处| 粤语骑马过海什么意思| 粉色裤子配什么上衣| 宜入宅是什么意思| 月经不来又没怀孕是什么原因| 什么情况不能献血| 孩子发烧吃什么药| 孤独症是什么| 黄金果是什么水果| 四个火读什么| rfc是什么意思| 朝鲜人一日三餐吃什么| 彩虹像什么挂在天空| 副总经理是什么级别| 手被辣椒辣了用什么方法解辣| 什么的杏花| 野鸡吃什么食物| 维生素b12有什么作用| 超能力是什么意思| 庙是什么意思| 2017年属什么| 也是什么意思| 大舅哥是什么意思| 鼓上蚤是什么意思| 什么症状吃柏子养心丸| 什么护肤品比较好| 扁桃体肿大是什么原因引起的| 王姓为什么出不了皇帝| 风寒感冒吃什么中成药| 性功能下降是什么原因| 许莫氏结节是什么意思| 积阴德是什么意思| 最好的止疼药是什么药| 为什么一站起来就头晕眼前发黑| 肺部纤维灶是什么意思| 今天是什么纪念日| 八三年属什么生肖| 什么命的人会丧偶| 运动员为什么吃香蕉| 椎管狭窄吃什么药| 什么是肾炎| 抱怨是什么意思| 什么叫985| 双龙戏珠是什么意思| 嘴唇正常颜色是什么样| 经常耳鸣是什么原因引起的| 夜未央是什么意思| 安欣是什么电视剧| 蜗牛有什么特点| 体检要带什么| 九月十号什么星座| aids是什么病的简称| 囊性结节是什么意思| 12月出生的是什么星座| 检查妇科清洁度三是什么意思| 慷慨什么意思| 查幽门螺杆菌挂什么科| 湿吻是什么意思| 长脸适合什么短头发| 胃窦在胃的什么位置| 儿童水杯什么材质好| 静若幽兰什么意思| 什么是有机奶粉| 什么拂面| 漫反射是什么意思| 落魄是什么意思| 发烧是什么症状| 刺梨果有什么功效| 乙肝病毒核心抗体阳性是什么意思| 商鞅变法是什么时期| 燃面为什么叫燃面| 可遇不可求什么意思| 黄金果是什么水果| 割包为什么很多人后悔| 白色裤子配什么上衣好看| 5.3什么星座| 心跳不规律是什么原因| 男士蛋皮痒用什么药| 更年期提前是什么症状| 傻白甜是什么意思| 心肌酶高是什么原因| 心脏搭桥是什么意思| 七月一号是什么节| 蛋白粉有什么功效| 异什么意思| 高丽棒子是什么意思| 脑梗看什么科| 世界上最大的生物是什么| 番茄什么时候种植| 仿水晶是什么材质| 湿气重吃什么药最有效| 老母鸡煲汤放什么食材补气补血| 烂脚丫用什么药最好| 眼袋大是什么原因引起的| 齁不住是什么意思| 缺营养吃什么补身体最好| 拉肚子是什么原因造成的| 吃什么补大脑记忆力| 黑枸杞和什么一起泡水喝比较好| 无用功是什么意思| 踮脚有什么好处| 射手后面的星座是什么| 国家安全法属于什么法| 绿豆煮出来为什么是红色的| 公开课是什么意思| 咳嗽能吃什么水果最好| 玉竹长什么样子| 内径是什么意思| 马踏飞燕什么意思| 地奥心血康软胶囊主治什么病| 血压什么时间测量最准| 脂肪肝是什么症状| 电气火灾用什么灭火| 拿铁是什么咖啡| 胃不舒服挂什么科| 肚子痛吃什么药好| n1是什么意思| 小日子是什么意思| 攒肚是什么意思| bmi是什么意思| 早搏的症状是什么表现| 黄连治什么病最好| 女性分泌物增多发黄是什么原因| 娘家人是什么意思| 茄子有什么功效和作用| 双子座和什么座最配对| 青城之恋是什么生肖| 桃花是什么颜色| 什么的耳朵| 肌酸激酶什么意思| 小孩子拉肚子吃什么药| 干湿分离什么意思| 什么情况下吃速效救心丸| 音字五行属什么| 六月十四号是什么星座| 长痘吃什么水果| 玫瑰糠疹吃什么药| 什么回大什么| 义愤填膺是什么意思| 赑屃是什么意思| 心慌心悸吃什么药| 梦见打死狗有什么预兆| 做体检挂什么科| 牙齿像锯齿是什么原因| pin是什么| 神仙眷侣是什么意思| 自私什么意思| 呆子是什么意思| iic是什么意思| 舌头干涩是什么病前兆| 白羊座和什么座最配| 阴虚火旺是什么意思| 新斯的明是什么药| 万丈深渊是什么意思| 鬼冢虎什么档次| 为什么一低头就晕| 爱是什么| 蠓虫叮咬后涂什么药膏| 八月二十二是什么星座| 阴道干涩吃什么药| 朋友梦到我怀孕了是什么意思| 一生一世是什么意思| 他是什么意思| 吊唁是什么意思| 乳腺囊肿和乳腺结节有什么区别| 梦见石榴是什么意思| mts是什么意思| 艾草治什么病| 月经前长痘痘是什么原因| 你说什么| 艾叶泡水喝有什么功效| 慌张的近义词是什么| 1999属什么| jojo什么意思| 蚊子喜欢什么味道| 萤火虫为什么会发光简单回答| 920是什么意思| 说话不清楚去医院挂什么科| 怀孕初期头晕是什么原因| 黑油是什么油| 张少华什么时候去世的| 百度
Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

HTML Tutorial

HTML HOME HTML Introduction HTML Editors HTML Basic HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Styles HTML Formatting HTML Quotations HTML Comments HTML Colors HTML CSS HTML Links HTML Images HTML Favicon HTML Page Title HTML Tables HTML Lists HTML Block & Inline HTML Div HTML Classes HTML Id HTML Iframes HTML JavaScript HTML File Paths HTML Head HTML Layout HTML Responsive HTML Computercode HTML Semantics HTML Style Guide HTML Entities HTML Symbols HTML Emojis HTML Charsets HTML URL Encode HTML vs. XHTML

HTML Forms

HTML Forms HTML Form Attributes HTML Form Elements HTML Input Types HTML Input Attributes Input Form Attributes

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Video HTML Audio HTML Plug-ins HTML YouTube

HTML APIs

HTML Web APIs HTML Geolocation HTML Drag and Drop HTML Web Storage HTML Web Workers HTML SSE

HTML Examples

HTML Examples HTML Editor HTML Quiz HTML Exercises HTML Website HTML Syllabus HTML Study Plan HTML Interview Prep HTML Bootcamp HTML Certificate HTML Summary HTML Accessibility

HTML References

HTML Tag List HTML Attributes HTML Global Attributes HTML Browser Support HTML Events HTML Colors HTML Canvas HTML Audio/Video HTML Doctypes HTML Character Sets HTML URL Encode HTML Lang Codes HTTP Messages HTTP Methods PX to EM Converter Keyboard Shortcuts

万家团圆夜请为“他们”的守护送份祝福!


百度 今日全国两会梅地亚新闻中心对中外记者开放。

This chapter describes the different types for the HTML <input> element.


HTML Input Types

Here are the different input types you can use in HTML:

  • <input type="button">
  • <input type="checkbox">
  • <input type="color">
  • <input type="date">
  • <input type="datetime-local">
  • <input type="email">
  • <input type="file">
  • <input type="hidden">
  • <input type="image">
  • <input type="month">
  • <input type="number">
  • <input type="password">
  • <input type="radio">
  • <input type="range">
  • <input type="reset">
  • <input type="search">
  • <input type="submit">
  • <input type="tel">
  • <input type="text">
  • <input type="time">
  • <input type="url">
  • <input type="week">

Tip: The default value of the type attribute is "text".


Input Type Text

<input type="text"> defines a single-line text input field:

Example

<form>
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname">
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

First name:

Last name:


Input Type Password

<input type="password"> defines a password field:

Example

<form>
  <label for="username">Username:</label><br>
  <input type="text" id="username" name="username"><br>
  <label for="pwd">Password:</label><br>
  <input type="password" id="pwd" name="pwd">
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

Username:

Password:

The characters in a password field are masked (shown as asterisks or circles).



Input Type Submit

<input type="submit"> defines a button for submitting form data to a form-handler.

The form-handler is typically a server page with a script for processing input data.

The form-handler is specified in the form's action attribute:

Example

<form action="/action_page.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  <input type="submit" value="Submit">
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

First name:

Last name:


If you omit the submit button's value attribute, the button will get a default text:

Example

<form action="/action_page.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  <input type="submit">
</form>
Try it Yourself »

Input Type Reset

<input type="reset"> defines a reset button that will reset all form values to their default values:

Example

<form action="/action_page.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  <input type="submit" value="Submit">
  <input type="reset" value="Reset">
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

First name:

Last name:


If you change the input values and then click the "Reset" button, the form-data will be reset to the default values.


Input Type Radio

<input type="radio"> defines a radio button.

Radio buttons let a user select ONLY ONE of a limited number of choices:

Example

<p>Choose your favorite Web language:</p>

<form>
  <input type="radio" id="html" name="fav_language" value="HTML">
  <label for="html">HTML</label><br>
  <input type="radio" id="css" name="fav_language" value="CSS">
  <label for="css">CSS</label><br>
  <input type="radio" id="javascript" name="fav_language" value="JavaScript">
  <label for="javascript">JavaScript</label>
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:




Input Type Checkbox

<input type="checkbox"> defines a checkbox.

Checkboxes let a user select ZERO or MORE options of a limited number of choices.

Example

<form>
  <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
  <label for="vehicle1"> I have a bike</label><br>
  <input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
  <label for="vehicle2"> I have a car</label><br>
  <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
  <label for="vehicle3"> I have a boat</label>
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:




Input Type Button

<input type="button"> defines a button:

Example

<input type="button" onclick="alert('Hello World!')" value="Click Me!">
Try it Yourself »

This is how the HTML code above will be displayed in a browser:


Input Type Color

The <input type="color"> is used for input fields that should contain a color.

Depending on browser support, a color picker can show up in the input field.

Example

<form>
  <label for="favcolor">Select your favorite color:</label>
  <input type="color" id="favcolor" name="favcolor">
</form>
Try it Yourself »

Input Type Date

The <input type="date"> is used for input fields that should contain a date.

Depending on browser support, a date picker can show up in the input field.

Example

<form>
  <label for="birthday">Birthday:</label>
  <input type="date" id="birthday" name="birthday">
</form>
Try it Yourself »

You can also use the min and max attributes to add restrictions to dates:

Example

<form>
  <label for="datemax">Enter a date before 2025-08-08:</label>
  <input type="date" id="datemax" name="datemax" max="2025-08-08"><br><br>
  <label for="datemin">Enter a date after 2025-08-08:</label>
  <input type="date" id="datemin" name="datemin" min="2025-08-08">
</form>
Try it Yourself »

Input Type Datetime-local

The <input type="datetime-local"> specifies a date and time input field, with no time zone.

Depending on browser support, a date picker can show up in the input field.

Example

<form>
  <label for="birthdaytime">Birthday (date and time):</label>
  <input type="datetime-local" id="birthdaytime" name="birthdaytime">
</form>
Try it Yourself »

Input Type Email

The <input type="email"> is used for input fields that should contain an e-mail address.

Depending on browser support, the e-mail address can be automatically validated when submitted.

Some smartphones recognize the email type, and add ".com" to the keyboard to match email input.

Example

<form>
  <label for="email">Enter your email:</label>
  <input type="email" id="email" name="email">
</form>
Try it Yourself »

Input Type Image

The <input type="image"> defines an image as a submit button.

The path to the image is specified in the src attribute.

Example

<form>
<input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form>
Try it Yourself »

Input Type File

The <input type="file"> defines a file-select field and a "Browse" button for file uploads.

Example

<form>
  <label for="myfile">Select a file:</label>
  <input type="file" id="myfile" name="myfile">
</form>
Try it Yourself »

Input Type Hidden

The <input type="hidden"> defines a hidden input field (not visible to a user).

A hidden field lets web developers include data that cannot be seen or modified by users when a form is submitted.

A hidden field often stores what database record that needs to be updated when the form is submitted.

Note: While the value is not displayed to the user in the page's content, it is visible (and can be edited) using any browser's developer tools or "View Source" functionality. Do not use hidden inputs as a form of security!

Example

<form>
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="hidden" id="custId" name="custId" value="3487">
  <input type="submit" value="Submit">
</form>
Try it Yourself »

Input Type Month

The <input type="month"> allows the user to select a month and year.

Depending on browser support, a date picker can show up in the input field.

Example

<form>
  <label for="bdaymonth">Birthday (month and year):</label>
  <input type="month" id="bdaymonth" name="bdaymonth">
</form>
Try it Yourself »

Input Type Number

The <input type="number"> defines a numeric input field.

You can also set restrictions on what numbers are accepted.

The following example displays a numeric input field, where you can enter a value from 1 to 5:

Example

<form>
  <label for="quantity">Quantity (between 1 and 5):</label>
  <input type="number" id="quantity" name="quantity" min="1" max="5">
</form>
Try it Yourself »

Input Restrictions

Here is a list of some common input restrictions:

Attribute Description
checked Specifies that an input field should be pre-selected when the page loads (for type="checkbox" or type="radio")
disabled Specifies that an input field should be disabled
max Specifies the maximum value for an input field
maxlength Specifies the maximum number of character for an input field
min Specifies the minimum value for an input field
pattern Specifies a regular expression to check the input value against
readonly Specifies that an input field is read only (cannot be changed)
required Specifies that an input field is required (must be filled out)
size Specifies the width (in characters) of an input field
step Specifies the legal number intervals for an input field
value Specifies the default value for an input field

You will learn more about input restrictions in the next chapter.

The following example displays a numeric input field, where you can enter a value from 0 to 100, in steps of 10. The default value is 30:

Example

<form>
  <label for="quantity">Quantity:</label>
  <input type="number" id="quantity" name="quantity" min="0" max="100" step="10" value="30">
</form>
Try it Yourself »

Input Type Range

The <input type="range"> defines a control for entering a number whose exact value is not important (like a slider control). Default range is 0 to 100. However, you can set restrictions on what numbers are accepted with the min, max, and step attributes:

Example

<form>
  <label for="vol">Volume (between 0 and 50):</label>
  <input type="range" id="vol" name="vol" min="0" max="50">
</form>
Try it Yourself »

Input Type Search

The <input type="search"> is used for search fields (a search field behaves like a regular text field).

Example

<form>
  <label for="gsearch">Search Google:</label>
  <input type="search" id="gsearch" name="gsearch">
</form>
Try it Yourself »

Input Type Tel

The <input type="tel"> is used for input fields that should contain a telephone number.

Example

<form>
  <label for="phone">Enter your phone number:</label>
  <input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}">
</form>
Try it Yourself »

Input Type Time

The <input type="time"> allows the user to select a time (no time zone).

Depending on browser support, a time picker can show up in the input field.

Example

<form>
  <label for="appt">Select a time:</label>
  <input type="time" id="appt" name="appt">
</form>
Try it Yourself »

Input Type Url

The <input type="url"> is used for input fields that should contain a URL address.

Depending on browser support, the url field can be automatically validated when submitted.

Some smartphones recognize the url type, and adds ".com" to the keyboard to match url input.

Example

<form>
  <label for="homepage">Add your homepage:</label>
  <input type="url" id="homepage" name="homepage">
</form>
Try it Yourself »

Input Type Week

The <input type="week"> allows the user to select a week and year.

Depending on browser support, a date picker can show up in the input field.

Example

<form>
  <label for="week">Select a week:</label>
  <input type="week" id="week" name="week">
</form>
Try it Yourself »


HTML Input Type Attribute

Tag Description
<input type=""> Specifies the input type to display

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

痰湿体质吃什么食物好 宝宝为什么打嗝 fred是什么牌子 睡觉被憋醒是什么原因 杨枝甘露是什么东西
金字旁加者念什么 1996年1月属什么生肖 结石吃什么好 什么是数字化 车前草有什么作用
葡萄糖偏高是什么意思 梦见自己相亲是什么征兆 小白脸是什么意思 肺痈是什么意思 为什么女的会流水怎么回事
日不落是什么意思 羊吃什么食物 降甘油三酯吃什么食物最好 靖国神社是什么 梦见生男孩是什么征兆
脸发烫是什么原因hcv9jop7ns9r.cn 非分之想什么意思hcv8jop5ns9r.cn 抖音什么意思hcv8jop0ns5r.cn 波长是什么weuuu.com 检查膝盖挂什么科hcv9jop5ns5r.cn
湿疹用什么药好cj623037.com 黄埔军校现在叫什么baiqunet.com 庚午日是什么意思hcv8jop4ns0r.cn 梦见鬼是什么意思hcv8jop0ns1r.cn 杨琴是什么乐器hcv8jop1ns2r.cn
澳大利亚人说什么语言hcv8jop7ns4r.cn 崖柏是什么hcv9jop3ns9r.cn 以什么当什么hcv8jop9ns7r.cn 前白蛋白低是什么意思hcv7jop6ns1r.cn 中盐是什么盐hcv9jop0ns6r.cn
男人都是大猪蹄子是什么意思hcv8jop8ns7r.cn 姓毛的男孩取什么名字好hcv8jop1ns8r.cn 鼻咽部淋巴组织增生是什么意思hcv8jop8ns8r.cn 男戴观音女戴佛有什么讲究jinxinzhichuang.com 吃什么可以止咳化痰hcv8jop0ns1r.cn
百度