HTML and CSS Reference
In-Depth Information
HTML5 solves this problem by providing a <time> element. Let's look
at an example:
<time datetime="2011-06-01">today</time>
We can be more specific:
<time datetime="2011-06-01T18:00:00+01:00">6 o'clock on 1/6/2011</time>
Humans get a readable time that they can disambiguate through the
context in the normal way, and computers can read the ISO 6801 date
and see the date, time, and time zone.
Time and data
Originally the <time> element had a pubdate attribute to allow for its use in
marking up blog posts and other articles. Early in 2012, the entire <time> ele-
ment was removed from the WHATWG version of the spec because it didn't ap-
pear to be getting used for that purpose. There was something of an uproar
within the community, and the <time> element was reinstated shortly after,
along with a new element, <data> , for more general-purpose association of
human-readable text with data for computers. At the time of writing, this
new element has not yet made it into the W3C version of the spec, so it isn't
covered here.
Images and diagrams with <figure> and <figcaption>
Putting an image in a web page is easy enough: the <img> element has
existed since the early days of the web. It was somewhat controversial
at the time, and several alternatives were put forward; but the most
popular browser (Mosaic) implemented it, so it became a de facto stan-
dard. The ability to add images was one of the main things that cata-
pulted the web from being an academic document-sharing network
into a worldwide phenomenon in the mid 1990s, but since that early
take-up not much has changed.
The <img> tag is limited from a semantic standpoint—there's no visible
way to associate explanatory text with the image. It's possible to use the
alt and longdesc attributes, but because neither is visible by default, both
have been somewhat ignored or misused in the real world. The <figure>
element offers an alternative—it groups the figure with its caption.
 
Search WWH ::




Custom Search