HTML time 时间标签
htmlweb developmentfront end technology更新于 2025/8/28 10:20:17
HTML 中的 <time> 元素用于在网页上设置和显示日期和时间。此标签于 HTML5 中引入。
以下是 − 属性
- datetime:要显示的日期时间。
现在让我们看一个在 HTML 中实现 <time> 标签的示例 −
示例
<!DOCTYPE html> <html> <body> <h2>Schedule</h2> <p>Exams begins from next <time datetime="06-15">Saturday</time>.</p> <p>Exam begins at <time>09:00</time> in the morning.</p> </body> </html>
输出

在上面的例子中,我们使用 <time> 元素 − 设置了日期和时间。
<p>Exams begins from next <time datetime="06-15">Saturday</time>.</p>
如果仅设置时间,请使用 <time> 元素,如下所示 −
<p>Exam begins at <time>09:00</time> in the morning.</p>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

