{"id":15315,"date":"2012-10-26T18:01:24","date_gmt":"2012-10-26T10:01:24","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=15315"},"modified":"2025-04-24T17:03:00","modified_gmt":"2025-04-24T09:03:00","slug":"scalable-vector-graphics-text","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/","title":{"rendered":"Working with Text Elements in SVG for Dynamic Designs"},"content":{"rendered":"<p>In previous posts, we\u2019ve explored how to use <a href=\"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphic-css-styling\/\">SVG to create shapes<\/a>. In this article, we will focus on <strong>creating and styling text with SVG<\/strong>. SVG text offers a range of possibilities that go beyond what HTML text can achieve.<\/p>\n<p>Let\u2019s dive into these possibilities.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-1\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphic\/\" class=\"ref-block__link\" title=\"Read More: A Look into: Scalable Vector Graphics (SVG)\" rel=\"bookmark\"><span class=\"screen-reader-text\">A Look into: Scalable Vector Graphics (SVG)<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/scalable-vector-graphic.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-15254 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/scalable-vector-graphic.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">A Look into: Scalable Vector Graphics (SVG)<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tVector graphics have been widely applied in print media. In a website, we can also add vector graphics...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<h2>Basic Text Implementation in SVG<\/h2>\n<p>Before we explore advanced features, let\u2019s see how <strong>text in SVG<\/strong> is formed at a basic level:<\/p>\n<pre>\n&lt;svg&gt;\n  &lt;text x=\"0\" y=\"15\"&gt;This is Scalable Vector Graphic (SVG) Text&lt;\/text&gt;\n&lt;\/svg&gt;\n<\/pre>\n<p>In SVG, text is defined using the <code>&lt;text&gt;<\/code> tag. This element primarily requires the <code>x<\/code> and <code>y<\/code> attributes to specify the baseline coordinates.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text baseline example\" height=\"200\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg\" width=\"500\"><\/figure>\n<p><em><strong>Image source:<\/strong><\/em> <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Baseline_(typography)\">Wikipedia.org<\/a><\/p>\n<p>As you can see, the text initially appears similar to regular HTML text.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"basic SVG text example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-basic.jpg\" width=\"500\"><\/figure>\n<h2>Styling SVG Text with CSS<\/h2>\n<p>SVG text can be styled using CSS properties such as <code>font-weight<\/code>, <code>font-style<\/code>, and <code>text-decoration<\/code>. These styles can be applied inline, internally, or externally, just as with HTML elements. Here are some examples:<\/p>\n<h4>Bold Text<\/h4>\n<pre>\n&lt;text style=\"font-weight: bold;\"&gt;This is text in Scalable Vector Graphic (SVG)&lt;\/text&gt;\n<\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"bold SVG text example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-bold.jpg\" width=\"500\"><\/figure>\n<h4>Italic Text<\/h4>\n<pre>\n&lt;text style=\"font-style: italic;\"&gt;This is italic text in Scalable Vector Graphic (SVG)&lt;\/text&gt;\n<\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"italic SVG text example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-italic.jpg\" width=\"500\"><\/figure>\n<h4>Underlined Text<\/h4>\n<pre>\n&lt;text style=\"text-decoration: underline;\"&gt;This is underlined text in Scalable Vector Graphic (SVG)&lt;\/text&gt;\n<\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"underlined SVG text example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-underline.jpg\" width=\"500\"><\/figure>\n<h4>Using the &lt;tspan&gt; Element<\/h4>\n<p>If you need to apply different styles to portions of text within the same line, you can use the <code>&lt;tspan&gt;<\/code> element. Here\u2019s how to add <strong>bold<\/strong>, <em>italic<\/em>, and <u>underline<\/u> to specific parts of the text:<\/p>\n<pre>\n&lt;text x=\"0\" y=\"15\"&gt;&lt;tspan style=\"font-weight: bold;\"&gt;This is bold&lt;\/tspan&gt;, &lt;tspan style=\"font-style: italic;\"&gt;this is italic&lt;\/tspan&gt; and &lt;tspan style=\"text-decoration: underline;\"&gt;this is underline&lt;\/tspan&gt;&lt;\/text&gt;\n<\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text tspan example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-tspan.jpg\" width=\"500\"><\/figure>\n<h2>Using Writing Mode in SVG<\/h2>\n<p>Text isn\u2019t always written left-to-right. For instance, Japanese text is often written top-to-bottom. SVG accommodates this with the <code>writing-mode<\/code> attribute.<\/p>\n<pre>\n&lt;text x=\"70\" y=\"20\" style=\"writing-mode: tb;\" class=\"japanese\"&gt;\u3041\u3043\u3045\u3047\u3049\u304b\u304d&lt;\/text&gt;\n<\/pre>\n<p>The code above demonstrates how random Japanese characters can be vertically aligned using <code>writing-mode: tb<\/code>, where <code>tb<\/code> stands for <strong>top-to-bottom<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"vertical SVG text example\" height=\"280\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-vertical.jpg\" width=\"500\"><\/figure>\n<h2>Creating Text Outlines in SVG<\/h2>\n<p><strong>SVG text is essentially a graphic element<\/strong>, which means you can apply the <code>stroke<\/code> attribute to outline the text, similar to other SVG shapes.<\/p>\n<pre>\n&lt;svg&gt;\n  &lt;text x=\"0\" y=\"50\" font-size=\"50\" font-weight=\"bold\" stroke=\"black\" stroke-width=\"0.5\" fill=\"none\"&gt;This is SVG Text&lt;\/text&gt;\n&lt;\/svg&gt;\n<\/pre>\n<p>In the example above, we use the <code>stroke<\/code> attribute to add an outline and remove the fill color by setting the <code>fill<\/code> attribute to <code>none<\/code>, resulting in the outlined text.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text with outline example\" height=\"100\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-outline.jpg\" width=\"500\"><\/figure>\n<h2>Making Text Follow a Path in SVG<\/h2>\n<p>In addition to horizontal and vertical text, SVG text can follow a custom path. Here\u2019s how to do it:<\/p>\n<p>First, define the <strong>path<\/strong>. While creating a path directly in HTML can be complex, involving coordinates and commands, it\u2019s simpler to use a vector editor like <a href=\"https:\/\/www.hongkiat.com\/blog\/free-windows-software-for-web-designers-on-budget\/\">Inkscape or Illustrator<\/a> to generate the SVG code.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text path creation using Illustrator\" height=\"169\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-illustrator-path.jpg\" width=\"500\"><\/figure>\n<p>Next, place the <code>&lt;path&gt;<\/code> element inside a <code>&lt;defs&gt;<\/code> element, which stands for \u201cdefinitions.\u201d<\/p>\n<pre>\n&lt;defs&gt;\n  &lt;path id=\"textpath\" fill=\"none\" stroke=\"#000000\" d=\"M0.057,0.024c0,0,10.99,51.603,102.248,51.603c91.259,0,136.172,53.992,136.172,53.992\"\/&gt;\n&lt;\/defs&gt;\n<\/pre>\n<p>We\u2019ve added an <code>id<\/code> attribute to the <code>&lt;path&gt;<\/code>. Now, link this <code>id<\/code> to your text using the <code>&lt;textPath&gt;<\/code> element:<\/p>\n<pre>\n&lt;use xlink:href=\"#textpath\"\/&gt;\n&lt;text x=\"10\" y=\"100\"&gt;\n  &lt;textPath xlink:href=\"#textpath\"&gt;\n    Lorem ipsum dolor sit amet consectetur.\n  &lt;\/textPath&gt;\n&lt;\/text&gt;\n<\/pre>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text following a path example\" height=\"200\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-path.jpg\" width=\"500\"><\/figure>\n<p><strong>Further reading:<\/strong> <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.w3.org\/TR\/SVG\/paths.html\">SVG Paths<\/a><\/p>\n<h2>Applying Gradient to SVG Text<\/h2>\n<p>Adding a gradient fill to text is also possible in SVG, and it\u2019s even easier if you\u2019ve completed the text path section above.<\/p>\n<p>Start by defining the gradient colors:<\/p>\n<pre>\n&lt;defs&gt;\n  &lt;linearGradient id=\"textgradient\" x1=\"0%\" x2=\"0%\" y1=\"0%\" y2=\"100%\"&gt;\n    &lt;stop stop-color=\"#999\" offset=\"0%\"\/&gt;\n    &lt;stop stop-color=\"#111\" offset=\"100%\"\/&gt;\n  &lt;\/linearGradient&gt;\n&lt;\/defs&gt;\n<\/pre>\n<p>With the gradient defined, you can now apply it to text by referencing the gradient\u2019s <code>id<\/code> in the <code>fill<\/code> attribute:<\/p>\n<pre>\n&lt;text x=\"0\" y=\"80\" font-size=\"72\" font-weight=\"bold\" fill=\"url(#textgradient)\" stroke=\"none\"&gt;Gradient&lt;\/text&gt;\n<\/pre>\n<p>Here\u2019s how the gradient-filled text will appear:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" alt=\"SVG text with gradient fill example\" height=\"200\" src=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/svg-text-gradient.jpg\" width=\"500\"><\/figure>\n<p><strong>Further reading:<\/strong> <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.w3.org\/TR\/SVG\/pservers.html#Gradients\">SVG Gradient and Pattern<\/a><\/p>\n<h2>Additional Resources<\/h2>\n<p>SVG text is incredibly powerful, and there\u2019s much more to explore beyond this article. Below are additional resources to deepen your understanding:<\/p>\n<ul>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/nimbupani.com\/about-fonts-in-svg.html\">About Fonts in SVG<\/a> \u2013 Divya Manian<\/li>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.w3.org\/TR\/SVG\/text.html\">SVG Text Official Documentation<\/a> \u2013 W3.org<\/li>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/SVG\">SVG Documentation at Mozilla Dev. Network with Examples and Tools<\/a> \u2013 MDN<\/li>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/SVG\/Attribute\/writing-mode\">SVG Writing Mode Attribute<\/a> \u2013 MDN<\/li>\n<\/ul>\n<div class=\"button\">\n    <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/hongkiat.github.io\/scalable-vector-graphics-text\/\">View Demo<\/a>\n    <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/hongkiat\/scalable-vector-graphics-text\/\">Download Source<\/a>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In previous posts, we\u2019ve explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a range of possibilities that go beyond what HTML text can achieve. Let\u2019s dive into these possibilities. Basic Text Implementation in SVG Before we explore advanced features,&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[3392,352],"tags":[2175],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Scalable Vector Graphics: Working with Text<\/title>\n<meta name=\"description\" content=\"In previous posts, we&#039;ve explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working with Text Elements in SVG for Dynamic Designs\" \/>\n<meta property=\"og:description\" content=\"In previous posts, we&#039;ve explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-26T10:01:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T09:03:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"Working with Text Elements in SVG for Dynamic Designs\",\"datePublished\":\"2012-10-26T10:01:24+00:00\",\"dateModified\":\"2025-04-24T09:03:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/\"},\"wordCount\":522,\"commentCount\":13,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/scalable-vector-graphics-text\\\/text-base-line.jpg\",\"keywords\":[\"Scalable Vector Graphics (SVG)\"],\"articleSection\":[\"Coding\",\"Web Design\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/\",\"name\":\"Scalable Vector Graphics: Working with Text\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/scalable-vector-graphics-text\\\/text-base-line.jpg\",\"datePublished\":\"2012-10-26T10:01:24+00:00\",\"dateModified\":\"2025-04-24T09:03:00+00:00\",\"description\":\"In previous posts, we've explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/scalable-vector-graphics-text\\\/text-base-line.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/scalable-vector-graphics-text\\\/text-base-line.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/scalable-vector-graphics-text\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Working with Text Elements in SVG for Dynamic Designs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Scalable Vector Graphics: Working with Text","description":"In previous posts, we've explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/","og_locale":"en_US","og_type":"article","og_title":"Working with Text Elements in SVG for Dynamic Designs","og_description":"In previous posts, we've explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a","og_url":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2012-10-26T10:01:24+00:00","article_modified_time":"2025-04-24T09:03:00+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg","type":"","width":"","height":""}],"author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"Working with Text Elements in SVG for Dynamic Designs","datePublished":"2012-10-26T10:01:24+00:00","dateModified":"2025-04-24T09:03:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/"},"wordCount":522,"commentCount":13,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg","keywords":["Scalable Vector Graphics (SVG)"],"articleSection":["Coding","Web Design"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/","url":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/","name":"Scalable Vector Graphics: Working with Text","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg","datePublished":"2012-10-26T10:01:24+00:00","dateModified":"2025-04-24T09:03:00+00:00","description":"In previous posts, we've explored how to use SVG to create shapes. In this article, we will focus on creating and styling text with SVG. SVG text offers a","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/scalable-vector-graphics-text\/text-base-line.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/scalable-vector-graphics-text\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Working with Text Elements in SVG for Dynamic Designs"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-3Z1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/15315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=15315"}],"version-history":[{"count":5,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/15315\/revisions"}],"predecessor-version":[{"id":74089,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/15315\/revisions\/74089"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=15315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=15315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=15315"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=15315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}