我怎样才能给 SVG 文档一个标题,它的工作方式与 HTML 文档的 <head> 中的 <title> 元素相同?

How can I give an SVG document a title, which works the same way as the <title> element in the <head> of an HTML document?

在 HTML 文档 <head> 中,<title> 元素声明了整个文档的 human-readable 名称,然后显示在浏览器中(当鼠标悬停在浏览器选项卡上时等)并被 user-agents.

理解

类似地,我怎样才能给 SVG 文档一个 top-level 标题,它实现与 HTML <title> 相同的 meta-data 功能并由浏览器显示并被 user-agents?

理解

我找不到任何网络文章/教程来验证这一点,但据我所知,将 meta-title 添加到 SVG 文档 非常简单。

在开始 <svg> 元素的正下方添加一个 SVG <title> 元素。

就是这样。

<title> 在 SVG 中比在 HTML 中使用得更多,但是 un-nested <title> 作为第一个元素放置在 SVG 文档的开头将作为整个SVG文档的meta-title

示例:

<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     viewBox="0 0 1200 1200">

<title>My SVG Document Title Here</title>
<!-- ^^^ SVG Title goes here at the start of the SVG -->

<defs>

  [... SVG DOCUMENT CONTINUES...]