• in
InterCourses
CoursesBlogs
0
← Introduction to HTML
○What is HTML?○Elements, Tags, and Attributes○Your First Complete Page
○Headings and Comments○Paragraphs, Emphasis, and Line Breaks○HTML Lists
○Hyperlinks○Images○Applying Styles to HTML
○Div and Span○HTML Tables○Classes and IDs
○Project 1 - Visiting Card Structure○Project 1 - Visiting Card Actions
○The Head Element and Page Title○Meta Tags○HTML Entities
○HTML Forms●Input Types○Checkboxes and Radio Buttons○Textarea and Select
○Embedding Video○Embedding Audio○Iframes
○Semantic HTML Tags○Details, Figure, and Figcaption
○Project 3 - Resume Semantic Structure○Project 3 - Resume Links and Actions

Input Types

HTML5 introduced many specialised <input> types that trigger appropriate virtual keyboards on mobile and enable built-in validation.

Text-based types

html
<input type="text"     name="username"   placeholder="Username" />
<input type="email"    name="email"      placeholder="you@example.com" />
<input type="password" name="password"   placeholder="Password" />
<input type="url"      name="website"    placeholder="https://example.com" />
<input type="search"   name="q"          placeholder="Search..." />
<input type="tel"      name="phone"      placeholder="+1 555 123 4567" />

Numeric types

html
<input type="number" name="qty" min="1" max="100" step="1" value="1" />

<!-- Slider -->
<input type="range" name="volume" min="0" max="10" step="1" />

Date and time types

html
<input type="date"          name="birthday" />
<input type="time"          name="appointment" />
<input type="datetime-local" name="event" />
<input type="month"         name="billing-month" />
<input type="week"          name="sprint" />

Other types

html
<!-- Colour picker -->
<input type="color" name="theme-color" value="#336699" />

<!-- File upload -->
<input type="file" name="avatar" accept="image/*" />

<!-- Hidden field (not visible, still submitted) -->
<input type="hidden" name="csrf_token" value="abc123" />

<!-- Buttons -->
<input type="submit" value="Submit" />
<input type="reset"  value="Reset" />
<input type="button" value="Click me" />

Type summary table

TypeValidatesMobile keyboard
textNoneStandard
emailMust contain @Email layout
urlMust start with schemeURL layout
telNone (format varies)Numeric/phone
numberMust be numericNumeric
searchNoneSearch layout
dateMust be valid dateDate picker
colorMust be valid hexColour picker

Your Task

Build a form that uses at least 5 different input types:

  1. A text field for a username.
  2. An email field.
  3. A number field with min, max, and step attributes.
  4. A date field.
  5. A color field.
  6. A submit button.
Hint 1
1 / 4
HINT 1

type="number" accepts only numeric input and supports min, max, and step attributes.

Loading editor…
READY
intercourses
html