- SVG - Linking
- SVG - Interactivity
- SVG - Gradients
- SVG - Patterns
- SVG - Filters
- SVG - Stroke
- SVG - Text
- SVG - Shapes
- SVG - Overview
- SVG - Home
SVG Demo
- SVG - Real Time SVG AD
- SVG - Demo Game
- SVG - Lazylinepainter.js Effects
- SVG - Full Screen Overlay Effects
- SVG - Transformation Effects
- SVG - Vague.js Effects
- SVG - zPath.js Effects
- SVG - Walkway.js Effects
- SVG - Velocity.js Effects
- SVG - Raphael.js Effects
- SVG - Tab Effects
- SVG - Side Show Effects
- SVG - Scroll Effects
- SVG - Playful Effects
- SVG - Gradients Effects
- SVG - Gooey Effects
- SVG - Brand Effects
- SVG - Arrow Effects
- SVG - Text With CSS Effects
- SVG - Text Effects
- SVG - Image Filter
- SVG - Flat Surface Shade
- SVG - Graph
- SVG - amChart
- SVG - Maps
- SVG - Key point
- SVG - Drag
- SVG - Clock
- SVG - Icons
- SVG - Dialog
- SVG - Loaders
SVG Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SVG - Text
<text> element is used to draw text.
Declaration
Following is the syntax declaration of <text> element. We ve shown main attributes only.
<text x="x-cordinates" y="y-cordinates" dx="pst of lengths" dy="pst of lengths" rotate="pst of numbers" textlength="length" lengthAdjust="spacing" > </text>
Attributes
Sr.No. | Attribute & Description |
---|---|
1 | x − x axis coordinates of glyphs. |
2 | y − y axis coordinates of glyphs. |
3 | dx − shift along with x-axis. |
4 | dy − shift along with y-axis. |
5 | rotate − rotation appped to all glyphs. |
6 | textlength − rendering length of the text. |
7 | lengthAdjust − type of adjustment with the rendered length of the text. |
Example
testSVG.htm<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="12" >Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM</text> </g> </svg> </body> </html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
Text with rotate
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="12" >Multipne Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan> <tspan x="30" y="70">We teach just for free.</tspan> </text> </g> </svg> </body> </html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
Multipne Text
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="570" height="100"> <g> <text x="30" y="12" >Multipne Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan> <tspan x="30" y="70">We teach just for free.</tspan> </text> </g> </svg> </body> </html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
Hyper pnk Text
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="10" >Text as Link: </text> <a xpnk:href="http://www.tutorialspoint.com/svg/" target="_blank"> <text font-family="Verdana" font-size="20" x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM</text> </a> </g> </svg> </body> </html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
Advertisements