I am new with the use of svg-sprites. I was wondering if there is a way to rotate an Icon from the sprite directly.
I tried to apply // transform: rotate(180) // to my icons-sprite.svg but I am doing something wrong, as the icon just disappears.
Here is the source code for my svg:
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icons-sprite" transform="translate(1.000000, 0.000000)">
<g id="thumb-down" transform=" translate(48.000000, 719.000000)">
<polygon id="Path" points="0 0 24 0 24 24 0 24"></polygon>
<path d="M15,2 L6,2 C5.17,2 4.46,2.5 4.16,3.22 L1.14,10.27 C1.05,10.5 1,10.74 1,11 L1,13 C1,14.1 1.9,15 3,15 L9.31,15 L8.36,19.57 L8.33,19.89 C8.33,20.3 8.5,20.68 8.77,20.95 L9.83,22 L16.42,15.41 C16.78,15.05 17,14.55 17,14 L17,4 C17,2.9 16.1,2 15,2 Z M19,2 L19,14 L23,14 L23,2 L19,2 Z" id="Shape" fill="#DB303E" fill-rule="nonzero"></path>
</g> ....
And here where I call the "_down" Icon via CSS:
&__down {
background: url('/images/icons/svg/icons-sprite.svg') -48px -692px
no-repeat;
background-size: 125px;
&_opac{
opacity: 0.4;
background: url('/images/icons/svg/icons-sprite.svg') -48px -692px
no-repeat;
background-size: 125px;
}
}
As mentioned, applying transform="rotate(180)" to the CSS file works fine, but I was wondering if it is more convenient (for whatever reason) to do it in the svg file. Here is what I have tried:
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icons-sprite" transform="rotate(180) translate(1.000000, 0.000000)">
<g id="thumb-down" transform=" translate(48.000000, 719.000000)">
<polygon id="Path" points="0 0 24 0 24 24 0 24"></polygon>
<path d="M15,2 L6,2 C5.17,2 4.46,2.5 4.16,3.22 L1.14,10.27 C1.05,10.5 1,10.74 1,11 L1,13 C1,14.1 1.9,15 3,15 L9.31,15 L8.36,19.57 L8.33,19.89 C8.33,20.3 8.5,20.68 8.77,20.95 L9.83,22 L16.42,15.41 C16.78,15.05 17,14.55 17,14 L17,4 C17,2.9 16.1,2 15,2 Z M19,2 L19,14 L23,14 L23,2 L19,2 Z" id="Shape" fill="#DB303E" fill-rule="nonzero"></path>
</g>
But it does not seem to work. My Icon just disappears when trying.
Thank you very much for your help!!
Carlos