7

FORMS

  • How to collect information from visitors
  • Different kinds of form controls
  • New HTML5 form controls

Traditionally, the term ‘form’ has referred to a printed document that contains spaces for you to fill in information.

HTML borrows the concept of a form to refer to different elements that allow you to collect information from visitors to your site.

Whether you are adding a simple search box to your website or you need to create more complicated insurance applications, HTML forms give you a set of elements to collect data from your users. In this chapter you will learn:

  • How to create a form on your website
  • The different tools for collecting data
  • New HTML5 form controls

image

WHY FORMS?

The best known form on the web is probably the search box that sits right in the middle of Google's homepage.

In addition to enabling users to search, forms also allow users to perform other functions online. You will see forms when registering as a member of a website, when shopping online, and when signing up for newsletters or mailing lists.

image

FORM CONTROLS

There are several types of form controls that you can use to collect information from visitors to your site.

ADDING TEXT:

Text input (single-line)

Used for a single line of text such as email addresses and names.

Password input

Like a single ...

Get HTML & CSS: Design and Build Websites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.