How to write text inside a <rect> tag in svg in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to write text inside a <rect> tag in svg in html?

4th Dec 2019, 7:38 AM
Sujan Kharal
Sujan Kharal - avatar
2 Answers
+ 3
🇮🇳Omkar🕉 Thank you very much
6th Dec 2019, 7:48 AM
Sujan Kharal
Sujan Kharal - avatar
+ 1
<!-- Sùjàñ Khârál *use <text> svg element. *place both rect and text elements in same parent svg tag. *refer:https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text *run code given below. --> <svg style="border:1px solid red; height:300; width:300;"> <rect x="40" y="40" height="150" width="150" fill="red"></rect> <text x="50" y="70" >This is some text</text> </svg>
4th Dec 2019, 8:11 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar