Menu

Input Types

Input Types

The input tag is the most commonly used form element, and it changes behavior completely depending on its type attribute. It supports plain text, email, password, checkboxes, radio buttons, and more.

This flexibility is what makes input so powerful. Instead of learning a new tag for every field type, you just change one attribute.

<input type="text" id="name" placeholder="Your name">



<input type="email" id="email" placeholder="Your email">



<input type="password" id="password" placeholder="Your password">



<input type="checkbox" id="subscribe">

<label for="subscribe">Subscribe to newsletter</label>



<input type="radio" id="male" name="gender">

<label for="male">Male</label>



<input type="radio" id="female" name="gender">

<label for="female">Female</label>

Explanation: Notice both radio buttons share the same name attribute, gender. This groups them together so you can select only one at a time. If they had different names, you could check both at once, which defeats the purpose of a radio button.


HTML Tutorial (From Basics to Implementation)

AP

Abhishek Pati





Get in Touch For Details