E
E
Evgeny Zhurov2018-08-27 18:08:42
SVG
Evgeny Zhurov, 2018-08-27 18:08:42

How to make text wrap and gradient in SVG?

Good afternoon. It is necessary to make text with a gradient in SVG. This is generally not a problem:

<svg>
       <defs> 
             <linearGradient id="textgradient" x1="0%" x2="100%" y1="0%" y2="0%">
                    <stop stop-color="#000" offset="0%"></stop>
                    <stop stop-color="#64284a" offset="60%"></stop>
                    <stop stop-color="#9d1e65" offset="80%"></stop>
                    <stop stop-color="#f89f7c" offset="100%"></stop>
             </linearGradient>
       </defs>
       <text x="0" y="0" fill="url(#textgradient)">Upgrade all senses</text>
</svg>

But, of course, the text output in this way does not wrap to a new line if it becomes wider than the block in which this svg lies.
Experiments with foreignObject did not give any result. Perhaps he did something wrong.
How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question