HTML and CSS Reference
In-Depth Information
Required Attributes
There are no required attributes for the em or strong elements.
Optional Attributes
The em and strong elements don't have any optional attributes.
Introduced in HTML5, the time element represents either a precise time on a 24-hour clock or a specific
date on the calendar (with an optional time as well). The element was introduced to standardize the way
dates and times are marked up, so that browsers and web apps can potentially detect and read encoded
dates/times and, for example, allow you to add an appointment to your calendar, or alert you when there
are five minutes remaining to bid in an online auction. The possible applications for machine-readable
dates and times are limitless.
Dates in a time element must follow a specific format that scripts and user-agents can interpret: a four-
digit year, two-digit month, and two-digit day, in that order, separated by hyphens (YYYY-MM-DD). Times
in a time element must be on a 24-hour clock, not a 12-hour clock, so “2:45 pm” would be written as
“14:45”. There's no default styling of time elements; they appear as regular text in whatever style they
inherit from their parents. Listing 4-27 shows two examples of time elements, marking a date and a time,
Listing 4-27. Two examples of the time element
<p>We'll be closed on <time>2012-05-05</time> but will reopen
at <time>08:00</time> sharp the following morning.</p>
The optional datetime attribute can carry the specific date and/or time in a machine-readable format,
freeing you to be more vague and human-friendly with your text:
<p>We'll be closed on <time datetime="2012-05-05" >Saturday, May 5</time>
but will reopen at <time datetime="08:00" >8 am</time> the day after.</p>
A datetime attribute can include both a date and time, with the time preceded by T :
<p>We will reopen on <time datetime="2012-05-06T08:00" >Sunday</time>.</p>
There are very specific requirements for formatting dates and times in a datetime
attribute, conforming to international standards. See the spec for much more detail:
Even with a datetime attribute, you should only use the time element for specific, known dates and times
like “August 8, 1961” or “10:02”, not for vague terms like “fifty years ago” or “an hour from now,” nor for
time spans like “77 nanoseconds” or “13.7 billion years.” Dates must also be complete—with date, month,
and year—so don't use a time element for partial or nonspecific dates like “December 20” or “1690” or
Search WWH ::

Custom Search