Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Attributes

0/1

HTML Paragraphs

0/1

HTML Formatting

0/1

HTML Comments

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML Symbols

0/1
Text lesson

The pattern Attribute

The pattern attribute uses a regular expression to validate input values on form submission, supported by input types like text, email, and password. The title attribute can describe the pattern for user guidance.

Example

An input field restricted to only three letters (excluding numbers and special characters):

<form>
  <label for=”country_code”>Country code:</label>
  <input type=”text” id=”country_code” name=”country_code”
  pattern=”[A-Za-z]{3}” title=”Three letter country code”
>

</form>

The placeholder Attribute

The placeholder attribute offers a brief hint about the expected input value, appearing in the field before the user types. It works with input types like text, email, and password.

Example

An input field featuring placeholder text:

<form>
  <label for=”phone”>Enter a phone number:</label>
  <input type=”tel” id=”phone” name=”phone”
  placeholder=”123-45-678″
  pattern=”[0-9]{3}-[0-9]{2}-[0-9]{3}”
>

</form>