I am experiencing an issue where my SVG code for icons is not rendering correctly because the main elements are being placed into <p>
tags automatically?
Here is an example of SVG code that renders correctly:
<a data-test="click:spotify" href="https://open.spotify.com/track/4tdffd5YR7AKoszZ1KKtR8" target="_blank" rel="noopener noreferrer" aria-label="Listen to I Need by DEFFENLO on Spotify" data-css-fisw11=""><div class="css-1ui5fco"><svg width="36" height="36" viewBox="0 0 45 45"><path style="fill:#1dd069" d="M45.71,23.22a22.5,22.5,0,1,0-6.59,15.91,22.5,22.5,0,0,0,6.59-15.91Z" transform="translate(-0.71 -0.73)"></path><path style="fill:#fff" d="M38.46,16.7a25.43,25.43,0,0,0-2.34-1.21q-1.18-.53-2.44-1A37.88,37.88,0,0,0,27.5,13a46.8,46.8,0,0,0-6.33-.59q-1.3,0-2.6,0t-2.6.16c-.83.08-1.64.17-2.43.29s-...
On the other hand, here is an example of SVG code that does not render correctly:
<a data-test="click:youtube" href="https://www.youtube.com/watch?v=QqsclUCRCJA" target="_blank" rel="noopener noreferrer" aria-label="Listen to DEFFENLO - I Need by DEFFENLO on YouTube" data-css-fisw11=""><div class="css-1ui5fco"><svg width="36" height="36" viewBox="0 0 45 45"><defs><style>.youtube-icon-circle-1{fill:red;}.youtube-icon-circle-2{fill:#fff;}</style></defs><circle class="youtube-icon-circle-1" cx="22.5" cy="22.5" r="22.5"></circle>< ...
The issue seems to stem from how the SVG code within the <p>
tags is being rendered incorrectly. To fix this issue, you can ensure that the SVG code is not wrapped within any <p>
tags by making sure all elements are structured without additional wrapping elements.