• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Text > The tspan element

The tspan element

Another consequence of not knowing a text string’s length in advance is that it is difficult to construct a string with varying text attributes, such as this sentence, which switches among italic, normal, and bold text. If you had only the <text> element, you’d need to experiment to find where each differently styled segment of text ended in order to space them properly. To solve this problem, SVG provides the <tspan>, or text span element. Analogous to the XHTML <span> element, <tspan> is a tabula rasa that may be embedded in text content, and upon which you may impose style changes. The <tspan> remembers the text position, so you don’t have to. Thus,


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint