XHTML: Should Doctype, Meta, and Link Be Closed As Single Tags?

Hello,

I’m following a video tutorial on XHTML. A major difference between HTML5 and XHTML is that the single tags are closed with a forward slash, i.e. <img />, <hr />.

I was wondering if the same is to be done with doctype, meta, and link, i.e.

> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
> <meta charset="utf-8" />
> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
> <link rel="stylesheet" href="./stylesheet.css" />

Thank you for your patience with my question.

Your friend,

RedC3ll

For any elements within the html structure, yes. That would include meta and link, etc.

doctype is different because it’s a directive to the browsers on how to interpret the html and everything within it. So it’s not a markup tag per se and does NOT get a closing slash.

1 Like

Thank you for your clarification.

Your friend,

RedC3ll

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.