L
L
Lev Penkin2021-12-15 22:30:19
css
Lev Penkin, 2021-12-15 22:30:19

Why is svg with a gradient not displayed if there are two such elements on the page and one of them lies in the parent, which is hidden?

I need to insert several identical svgs on the page, put one of them in a div, hide this div through display:none The problem is that if I set display:none, all identical svgs on the page stop showing This problem only appears if the svg has Gradient Why is this happening? Whether it is possible to bypass it somehow?

Example: codepen

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SuperToster, 2021-12-16
@Pandddv

Find in the code of the icons
id="Instagram_2_"
and
fill="url(#Instagram_2_)"
In the code of the first icon, rename the id and fill pair from Instagram_2_, for example, to Instagram_2_ONE
In the code of the second icon, rename the pair of id and fill from Instagram_2_, for example, to Instagram_2_TWO
In general, in order not to suffer like this, it is better to use sprites.

E
Evgeny Perin, 2015-07-13
@muaythai075

Make a 301 redirect from the old URLs to the new URLs. To do this, you can use plugins (for example, seo redirect or something like that), or you can manually write it in htaccess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question