简体   繁体   中英

How to make a new line in raphael JS text?

I was trying to use <br> and \\n , but it seems not to work inside text in raphael js.

I need it to be inside one text, because I am using multiple resize effects in different languages (one language has three lines and one 4 lines).

My code that is not working:

var mytext = paper.text(150, 250, "Line1<br>Line2");

It works with \\n , see a live demo on jsFiddle , illustrating this.

Also have a look at the Raphaël reference , here's a pullquote from the entry on text() :

Draws a text string. If you need line breaks, put “\\n” in the string.

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