New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to generate a sprite with margin, without adding padding to each icon #200
Comments
I'm trying to do the same thing. What are the different |
Update: I just found this conversation: #24 That seems like what we are looking for. The combination of
I can't figure out what settings I need to keep the dimensions the size of the icons, not the icons plus padding. |
I cannot try right now if it works, but can you try with |
Ok, |
@ghusse: Correct, |
@jkphl: Perhaps we should be using a different setting here? Thank you. |
I took a look at this for a while and it seems like
If I am reading this correctly than the default value of Furthermore, I cannot find anywhere in the source where we check against the value of
The rub is that there isn't a single reference to |
I am using this template to be able to use padding as margin (assuming there is equal padding on both sides):
This uses absolute positioning to avoid further rounding errors. It would be more convenient to be able to have a "content-box" model, as suggested. Or a specific margin setting. |
hey @vincentbernat, where exactly did you put that piece of code? I'm trying to achieve the same. |
Put it in any file and use |
Thanks @vincentbernat, I went with another option: brunobasto@9c05c34#diff-0c4330786baaab2bd590c6e37356de51R260 I'm not using it for a web project. I'm using it to arrange multiple images on a grid arrangement so that I can print to a transparency paper. Margins are essencial to distinguish one image from the other after it's printed. |
I've created template for Sass which can help with this issue and published as a gist. Code based on @vincentbernat solution. |
Hi. @vincentbernat solution is very nice and works great (I used @panych solution as well) however because of px there is no more possibility to use |
I had the same issue, the artefact from the icon next to it was showing up when zoomed. I noticed that this happened because my SVG had some properties like "transform: translate" which caused these issues. I fixed it by adding a white border around the SVG that caused the problem. Not the most elegant solution but it works fine in my case. |
Works but its very very stupid output: |
Hello,
I have an issue with generated sprites and how individual icons are displayed in the browser in the end.
With the default configuration, in some browsers, icons are sometimes displayed with a part of the icon next to them. I can see that in safari, here is an example:
I tried to used padding in the config, it worked great because it added margin around images in the generated SVG. But the drawback was that images were also larger in the CSS.
Padding is added to images dimensions in the CSS, so it does not work for me.
Is there a way to generate a stacked svg sprite with margin around images, without modifying their size?
I tried different
box
configuration values, but without any luck.Thanks
The text was updated successfully, but these errors were encountered: