Posts in current category

HTML5 <time> tag


May 03, 2021 20:00 HTML5


Table of contents


HTML5 labels are used to label dates, times, or combinations of dates and times (date format is YYYY-MM-DD). Please refer to the following example:

How to define a time and date:

<p>我们在每天早上 <time>9:00</time> 开始营业。</p> <p>我在 <time datetime="2017-02-14">情人节</time> 有个约会。</p>
Try it out . . .

Browser support

The numbers in the table support the version number of the first browser for this property.

Elements
<time> 6.0 9.0 4.0 5.0 11.1

Label definition and instructions for use

The label defines the time (24-hour system) or date of the Gregorian calendar, and the time and time zone offsets are optional.

This element encodes dates and times in a machine-readable manner so, for example, that a user agent can add birthday reminders or scheduled events to a user's calendar, and search engines can generate smarter search results.


The difference between HTML 4.01 and HTML5

The label is the new label in HTML5.


Property

New : The new property in HTML5.

Property Value Describe
Datetime New Datetime Set a date/time. Another way is to give a date/time by the contents of the element.

Global properties

Labels support the global properties of HTML.


The event property

The tag supports the event properties of HTML.