HTML5 Elements
HTML5 newly added <input> Types
Input Type | Description |
---|---|
color | Defines an input field with a specific color. |
date | Defines an input field for selection of date. |
datetime-local | Defines an input field for entering a date without a timezone. |
Defines an input field for entering an email address. | |
month | Defines a control with month and year, without a time zone. |
number | Defines an input field to enter a number. |
url | Defines a field for entering URL. |
week | Defines a field to enter the date with week-year, without a time zone. |
search | Defines a single line text field for entering a search string. |
tel | Defines an input field for entering the telephone number. |
<input type="color">
The <input> type "color" is used to define an input field which contains a colour. It allows a user to specify the colour by the visual colour interface on a browser.
<input type="date">
The <input> element of type "date" generates an input field, which allows a user to input the date in a given format. A user can enter the date by text field or by date picker interface.
<input type="datetime-local">
The <input> element of type "datetime-local" creates an input field which allows a user to select the date as well as local time in the hour and minute without time zone information.
<input type="email">
The <input> type "email" creates an input field which allows a user to enter the e-mail address with pattern validation. The multiple attributes allow a user to enter more than one email address.
<input type="month">
The <input> type "month" creates an input field which allows a user to easily enter month and year in the format of "MM, YYYY" where MM defines month value, and YYYY defines the year value.
<input type="number">
The <input> element type number creates an input field which allows a user to enter the numeric value. You can also restrict the user to enter a minimum and maximum value using min and max attributes.
<input type="url">
The <input> element of type "url" creates an input field which enables the user to enter the URL.
<input type="week">
The <input> type week creates an input field which allows a user to select a week and year from the drop-down calendar without a time zone.
<input type="search">
The <input> type "search" creates an input field which allows a user to enter a search string. These are functionally symmetrical to the text input type, but may be styled differently.
<input type="tel">
The <input> element of type "tel" creates an input field to enter the telephone number. The "tel" type does not have default validation such as email, because telephone number patterns can vary worldwide.
Important HTML5 Elements
Some important structure elements associated with HTML5.
<header>
The <header> element represents the header of a document or a section.
Eg:
<header>
<h1>Heading</h1>
<p>Description here</p>
</header>
<aside>
<aside> tag describes contents like the sidebar to be set to the side.
Eg:
<aside>
<a href = "about.html">About Us</a>
<a href = "contact.html">Contact Us</a>
</aside>
<section>
<section> is used to set a part of the content for one section element in a document.
Eg:
<section>
<h1>Fruits</h1>
<p>Apple, Orange and Banana are fruits..</p>
</section>
<nav>
<nav> contains a set of navigation links mainly used to create menu sections for the web page.
Eg:
<nav>
<ul>
<li><a href = "about.html">About Us</a></li>
<li><a href = "contact.html">Contact Us</a></li>
</ul>
</nav>
<footer>
It is used to create a footer for a document or section.
Eg:
<footer>
<address>
Address: street, district, state, pin
</address>
<p>Copyright © 2022 All rights reserved.</p>
</footer>