🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

HTML <input> Tag

Create form input fields. Learn input types, attributes, and form structure.

input.html
<!-- Form Input -->
<form>
<label for="username">Username:</label>
<input type="text"
id="username"
name="username"
placeholder="Enter username">
</form>
⌨️
input.html
1 / 7
⌨️

Tutor:The <input> tag creates an input field for forms. It's a void element (no closing tag) and requires a type attribute to specify what kind of input to create (text, password, email, checkbox, radio, etc.).


Input Mastery

Unlock nodes by learning input types and form attributes.

Concept 1: The Input Tag

The <input> tag creates an input field for forms. It's a void element (no closing tag) and requires a type attribute to specify what kind of input to create (text, password, email, checkbox, radio, etc.).

System Check

Which attribute is required for <input> to specify the input type?


Community Holo-Net

Share Form Structures

Created effective forms with inputs? Share your code and best practices.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

HTML <input> Tag

Author

Pascual Vila

Frontend Instructor.

The <input> tag creates an input field for forms. It's a void element (no closing tag) and requires a type attribute to specify what kind of input to create (text, password, email, checkbox, radio, etc.).

Input Types

Common input types include: text (single-line text), password (hidden text), email (email validation), checkbox (multiple selections), radio (single selection), submit (form submission button), button, number, date, and many more. The type attribute determines the input's behavior and appearance.

Required Attributes

The type attribute is required and specifies the input type. The name attribute identifies the input when the form is submitted. Always include both for proper form functionality.

Form Structure and Accessibility

Always wrap inputs in a <form> tag. Use <label> with the for attribute matching the input's id for accessibility. The placeholder attribute shows hint text. Use required for mandatory fields.

Best Practices

Always include the type and name attributes. Use id and connect it to a <label> for accessibility. Wrap inputs in a <form> tag. Use appropriate input types for better validation and user experience. Add placeholder for hints and required for mandatory fields.

Input Tag Glossary

<input>
HTML void element that creates an input field for forms. Requires a type attribute to specify the input type (text, password, email, checkbox, radio, etc.).
type Attribute
Required attribute that specifies what kind of input to create. Common values: text, password, email, checkbox, radio, submit, button, number, date, etc.
name Attribute
Identifies the input when the form is submitted. Required for form inputs to be properly processed. Used to access input values in form data.
Form Structure
Inputs should be wrapped in a <form> tag. Use <label> with for matching the input's id for accessibility. This helps screen readers understand form structure.
Common Input Types
text (single-line text), password (hidden text), email (email validation), checkbox (multiple selections), radio (single selection), submit (form button), button, number, date, file, search, tel, url, and many more.