Annotating Documents

Another method of commenting your code involves the title and desc elements. The title and desc elements allow developers to provide descriptive text on both a document and object level. Similar to the comment, the title and desc elements can accept plain text content between their tags. These two elements, though not required, are encouraged for several reasons.

  • Other developers, upon examining your code, will be able to discern a greater amount of context for your document.

  • Some SVG viewers will use title element content as “tool-tip” text, meaning that when a user's cursor is over an object with a title element, the title element's contents display in a box above the content.

  • By providing your document and elements with ...

Get Sams Teach Yourself SVG in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.