html - SVG text element breaking out of parent width -
so set width of svg element 100% , width of last text element have in there exceeds width of svg element parent.
i've tried using word-wrap , setting max-width text element no avail.
basically, want text element not break out of parent svg element it's doing, , words wrap when reach edge of parent element's width.
also, don't want move text element on left, have it's @ purposefully.
<svg height="1000" width="100%"> <circle cx="50%" cy="50" r=40 stroke="black" stroke-width="2" fill="white"/> <text x="49.8%" y="50" font-family="sans-serif" font-size="20px" text-anchor="middle" fill="black" dy=".38em">1939</text> <line x1="50%" y1="90" x2="50%" y2="950" style="stroke:black;stroke-width:2"/> <text id="first-life-block" x="50%" y="150" font-family="sans-serif" font-size="20px" fill="black" style="word-wrap: normal;">lorem ipsum dummy text of printing , typesetting industry.</text> </svg>
here's screenshot of problem in debugger mode
here's link codepen dubugger page: http://s.codepen.io/edsonmendieta/debug/jqjrry
help appreciated :)
svg 1.1 doesn't support wrapping of text.
you'd have manually split javascript separate elements or put text in
<foreignobject>
, let wrap html text.
also check this answer "auto line-wrapping in svg text" , this jsfiddle (long) javascript workaround.
Comments
Post a Comment