Master AI & Build your First Coding Portfolio with SkillReactor | Sign Up Now

Lesson 2 - HTML Tags And Elements

2.3 Input Fields

Input fields in HTML enable users to enter various types of data, such as text, numbers, or passwords. The <input> tag is used to create these fields.

<input type="text" placeholder="Enter your name">
<input type="password" placeholder="Enter your password">

In the example above:

  • type="text" specifies an input field for text.
  • type="password" specifies an input field for passwords, where the input characters are masked for security.
  • placeholder="Enter your name" and placeholder="Enter your password" are attributes that provide hints or examples of what to enter in each input field.

HTML supports a wide range of input types, each tailored for different purposes:

<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">

These types allow you to create input fields tailored to specific data requirements, enhancing usability and functionality on your webpages.