+ 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