简体   繁体   中英

How to display the text over svg rect in Javascript

I want to display the text over the svg rect. Text is hidden in the sample. I want full text as visible :

 <svg width="400" height="110"> <rect width="300" height="100" style="fill:white;stroke-width:3;stroke:rgb(0,0,0);"/> <text x="10" y="35" fill="red">I love SVG! Text Chart</text> </svg> <svg height="300" width="60" style="position:absolute;left:20px;top:20px"> <rect width="300" height="50" style="fill:yellow;stroke-width:3;stroke:rgb(0,0,0);"/> </svg> 

Here is the updated code:-

 <svg width="400" height="110"> <rect width="300" height="100" style="fill:white;stroke-width:3;stroke:rgb(0,0,0);"/> </svg> <svg height="300" width="1000" style = "position:absolute;left:20px;top:20px"> <rect width="60" height="60" style="fill:yellow;stroke-width:3;stroke:rgb(0,0,0);"/> <text x="10" y="35" fill="red">I love SVG! Text Chart</text> </svg> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM