question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Two SVGs on the same page interfering

See original GitHub issue

In some cases, when I import two different SVGs onto the same page, their styles interfere, and one image becomes distorted (or there’s an extra shadow, etc.).

For example:

import Tree from '-!svg-react-loader!../../images/tree.svg';
import Mountain from '-!svg-react-loader!../../images/mountain.svg';

The components are then rendered inline. Does anyone know how to make sure the SVGs don’t interfere with each other?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
SilverFox70commented, Aug 21, 2018

Yes! I had the same problem and the underlying cause has to do with the IDs in the SVGs. I have a created a fork of this that solves this problem and is very easy to use. One caveat: if you have two or more SVGs with the same exact name you will still get ID collisions and issues. Check it out here: https://github.com/SilverFox70/svg-react-loader

0reactions
0xferitcommented, Oct 30, 2020

Any updates on this? I am having the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two SVGs on one HTML page are affecting each other
I have the two SVG elements on the same html page. If I set the second SVG's value of svg/defs/clipPath/rect.width then it affects...
Read more >
Display issue with 2 svg files on the same page - WordPress.org
I have set 2 svg images on that page. The first one displays over 992px page width and the second one under 992px....
Read more >
5 Gotchas You're Gonna Face Getting Inline SVG ... - CSS-Tricks
The same idea holds true for any JavaScript manipulations on the SVG clone itself. ... Gotcha Two: Working With A Designer.
Read more >
Cookbook - vpype documentation
This command will read two SVG files onto two different layers, then write them ... layer ID value n of 100 to avoid...
Read more >
Migrating to v5 - Bootstrap
Track and review changes to the Bootstrap source files, documentation, and components to help you migrate from v4 to v5. On this page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found