什么是使用HTML5< time>标签? [英] What’s the point of using the HTML5 <time> tag?

查看:178
本文介绍了什么是使用HTML5< time>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在浏览一些关于< time> 标签的教程,但我真的不明白为什么我们要使用它。

I have been going through some tutorials on the <time> tag, but I honestly don't see why we are using it.

例如:

For example:

Published <time pubdate datetime="2011-07-03">07/03</time>

如果我们要有一个字符串07/03,那么使用时间的目的是什么标签?
它不验证任何东西。

If we are going to have a string 07/03 anyway, what is the purpose of using a time tag? It doesn't validate anything.

推荐答案

这个标签的重点在于一些新的语义HTML5标签,是为了让程序更容易索引您的数据。

The point of this tag, as with a number of the new "semantic" HTML5 tags, is to make it easier for programs to index your data.

脚本可以通过并轻松找出您的博客文章的发布日期如果它看到一个< time> 标签,而不必解析这些可以表示的任何方式(供人类消费),这将是更复杂和容易出错的任务。

A script can go through and easily find out what the published date is for your blog articles if it sees a <time> tag, without having to parse any of a number of ways this could be represented (for consumption by a human being), which would be a much more complex and error-prone task.

这篇关于什么是使用HTML5&lt; time&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆