Web Development Course:
HTML time: Main Tips
- The HTML
timetag is used to represent time.
- You can define time in a time duration, an exact time on a 24-hour clock, or an exact date in the Gregorian calendar.
- You must use both opening and closing tags.
Using the time Tag
time tag defines a specific time:
<h2>The premiere show starts at <time>21:00</time> today.</h2>
It should not be used when a particular date is:
- impossible to calculate
- earlier than the introduction of Gregorian calendar
The datetime Attribute
The content of HTML
time tag can also be made machine readable by using the
<h2>The premiere show starts at <time datetime="2017-07-07T21:00:00Z">21:00</time> coming Friday.</h2>
datetime attribute value can be a representation of a time duration or a Gregorian calendar date. It allows browsers and search engines to provide a better user experience.
Mobile browser support
HTML5 Tags List: Get to Know the Most Useful Elements
Find HTML5 tags explained and illustrated with beginner-friendly HTML5 examples. Grasp the difference between HTML5 tags & elements and learn to use both!
HTML5 Semantic Tags: What Is Semantic Markup?
HTML5 semantic tags and HTML5 semantic elements: why do you need to write semantic HTML? Start using semantic markup to create HTML5 semantic tags.