The main idea is, I'm looking for the best way to add an SVG to a pseudo-element that still preserves its color-changing (for hover). And all of this preferably without HTML and definitely not JS. I'm looking for a simpler plug class and it's their sort of solution with CSS only.
I have read a discussion here: Is there a way to use SVG as content in a pseudo element ::before or ::after
Here mainly people are talking about adding it as a content as such:
content: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20en...)
Here the problem lies that I cannot change the color of the SVG.
The same lies with solutions just adding it as content or background.
The only way I could find doing this is through ` height: 25px; width: 30px;
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background: #fff;
-webkit-mask-image: url('button.svg');
mask-image: url('button.svg');`
This is though quite a bit of boilerplate code that needs to be written. But it does allow the color to be changed on hover through the background field.
Is there a better way to do this on modern browsers (excluding IE11), or shall I stick to my tried and tested mask way of doing things.
I appreciate any and all input.