i’d like to remove the svg filter i added to a div from the button children but i’m blocked
HTML
<div id="parchment" class="contain">
<button style="background-image: url('path/to/image2.jpg');" onclick="redirectTo('pagina2.html');">dfwfefesefse</button>
<button style="background-image: url('path/to/image3.jpg');" onclick="redirectTo('pagina3.html');"></button>
</div>
<svg >
<filter id="wavy2">
<feTurbulence x="0" y="0" baseFrequency="0.02" numOctaves="5" seed="1" />
<feDisplacementMap in="SourceGraphic" scale="20" />
</filter>
</svg>
CSS
#parchment {
***CODE***
padding: 4em;
box-shadow: 2px 3px 20px black, 0 0 125px #8f5922 inset;
filter: url(#wavy2);
****CODE***
https://codepen.io/pro-Jack-ZeroTheCrazy/pen/JjezPYa
i tried to put
filter: none;
but it is not working, i even tried to counter the effect by putting a ""reverse"" filter on the buttons but i don’t seems to be able enought to do it
2
Answers
You can’t disable a filter for individual child elements.
As a workaround you could prepend the filtered background as an absolutely positioned pseudo element like so:
Now the filter is only applied to this background element
I don’t believe it’s possible to have the filter not effect the children. I see no reason why you would need to have the buttons as children or the need for the JS anyway.
You can could wrap the buttons in a container and have them both be children of a container. Then stretch the parchment like you had using absolute.