HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

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

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

HTML Form Elements Tutorial

Introduction

An HTML form is used to collect user input, such as text, numbers, selections, etc. Form elements are used to create different input fields within a form. In this tutorial, we will cover some of the common HTML form elements and how to use them.

Text Input

The <input> element with type "text" is used to create a single-line text input field.

<input type="text" name="username" id="username">

Password Input

The <input> element with type "password" is used to create a password input field where the characters are masked.

<input type="password" name="password" id="password">

Checkbox

The <input> element with type "checkbox" is used to create a checkbox input field.

<input type="checkbox" name="subscribe" id="subscribe"> Subscribe to our newsletter

Radio Buttons

The <input> element with type "radio" is used to create a radio button input field. Radio buttons are used when only one option out of multiple options can be selected.

<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female

Select Dropdown

The <select> element is used to create a dropdown list of options for the user to select from.

<select name="country" id="country">
  <option value="us">United States</option>
  <option value="ca">Canada</option>
  <option value="uk">United Kingdom</option>
</select>

Text Area

The <textarea> element is used to create a multi-line text input field.

<textarea name="message" id="message" rows="4" cols="50"></textarea>

Submit Button

The <input> element with type "submit" is used to create a submit button for the form.

<input type="submit" value="Submit">

Example Form

Username:
Password:
Subscribe: Subscribe to our newsletter
Gender: Male Female
Country:
Message: