HTML and CSS tips #18 "You don't have to use the span element to markup dates"

github logo ・1 min read

You should use the time element with the datetime attribute when you need to markup dates. For example, it's suitable for markup of publication date or day of the week.

Don't do it

<span>October 5</span>
<span>two days ago</span>
<span>a Saturday</span>

You can use it instead

<time datatime="2019-10-05">October 5</time>
<time datatime="2019-01-29">two days ago</time>
<time datatime="2019-09-23">a Saturday</time>

P.S: I share my experience with my Linkedin subscribers. Are you interested? Join to us! 👉

twitter logo DISCUSS
Classic DEV Post from Feb 22

What are the books about software engineering history that you have enjoyed most?

Trying to compile a list of software engineering books about that software or those products that we enjoyed most when we were younger and that are now history of software development.

Stas Melnikov profile image

Sore eyes? now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️