SVG sprite: how to handle sizes? - svg

I am searching for a good solution to work with SVG Sprites.
Currently I have a folder of svg files, with grunt-svg-sprite I get a SVG sprite image and a CSS File with background image definitions.
Now I want to replace my single-file SVGs with the sprite SVG, but I cant resize them. Some of them are not in the correct size in the original file. I tried lots of combinations with width, height, background size, without success.
Here is the CSS with single file SVG for a list item with a checkbox image:
li {
background-image: url(../../img/check_red.svg);
background-position: 0 12px;
background-repeat: no-repeat;
background-size: 16px auto;
padding-left: 26px;
}
How to do this with a sprite SVG?
I need a solution with some kind of automation: new SVG files are added after running a task, SVGs have different sizes, and so on.
What I tried already and did not work was grunt-svgstore, the SVG images were messed up (changed shapes, lines, colors)

What about this approach here:
.icon-clock {
background: url("sprite.svg#svgView(viewBox(0, 0, 32, 32))") no-repeat;
}
I did not test it but it allows you to define the viewbox inside the background.
(Source: https://css-tricks.com/svg-fragment-identifiers-work/)

Related

Vertical-align image without absolute position

I have a slider with images, some of which are bigger than the viewport.
The top of the images aligns with the top of the viewport, so that the bottom part of the images is cut with overflow:hidden.
div.flex-viewport{
height:350px !important;
overflow:hidden !important;
}
div.flex-viewport img{
min-height:350px !important;
min-width:940px !important;
}
But I want the bottom of the images to be aligned with the bottom of the viewport, so that the top is cut.
Normally, I would use absolute positioning to achieve this, but that somehow renders the images invisible (in FlexSlider).
Vertical-align doesn't work. Any thoughts?
Try fixing the height of the image with CSS
.classofimage {
height: heightofslider;
}
Let the width be flexible. To put in the images, make sure the width of all images does not exceed the slider width. You can do this in photoshop.

Eliminating Website Horizontal Scroll

I have been changing lots of things to my website and now I somehow have created it to not fit to screen and has a tiny scroll to the right. Can someone see the issue that is causing this.
Looking to get rid of the black on the right hand side. Only the top and bottom should be black.
www.jobspark.ca is the website
UPDATE
So this is the line of code that is causing the black space. But when I remove the 100% the image shrinks back to fit into the 960px site width. Any ideas? im ready to give up haha Squarespace is not easy to modify
#collection-513d5347e4b0abff73be5267 #site > .wrapper {
max-width: 100%;
padding: 0 0px;
margin: 0 auto;
}
My guess is you you have width:100% on your div elements, this forces the client area of each element to fill the browser. Now since the elements' borders add an additional pixel on each side, you end up with a scrollbar.
I would recommend that you omit width:100% from your div elements. It should auto expand to 100% of it's parent and that should solve your problems.
If all fails this should work,
overflow-y: auto; // or replace auto with scroll
overflow-x: hidden;

How can I align my Left and Right borders that susy calculates?

I'm trying to design something similar to GitHubs sliding file browser
It's mostly working but im trying to style it and I get this with my borders:
.claim-header, .support-header{
text-align: center;
background-color: $argument-review-banners;
padding: 0.3em;
font-family: "Jockey One",Arial,Georgia,sans-serif;
font-style: normal;
font-weight: 400;
font-size: 20px; // <--- this line breaks it
text-transform: uppercase;
border-color: black;
border-style: solid;
}
it appears as if the font-size within the div (each one of these rows is a div as it's not really a table, as I'm not doing file browsing per se) is what breaks it, it seems to make the calculation of the width different because of font-size. I thought that susy caculates widths based on the base-font, not the font of the element. It's off by 2 pixels and I wonder if this is some sort of rounding error.
I could fix it with yet another wrapper div. But I'm wondering what the proper solution would be.
This issue is not related to Susy - you would have the same problem with any em-based width. Susy has no way of knowing that you changed the font size, or want to use a different em value - that all gets calculated at the browser level.
The container mixin will output the same em width each place you use it (given the same settings), but em's are relative to local font-size. That's calculated by the browser, and Susy has no knowledge of it, or control over it. There are several options.
You can build your grids in rem (root em) values instead, on modern browsers.
You can use the $container-width setting to override the calculated width - use px, %, or set the width .
You can set a single outer container (maybe the <body>?) around all these elements.
You can change the font size in a nested element, rather than on the container.

How to maintain pixel when zooming into SVG canvas?

I've built a frontend tool for zooming in/out of an SVG canvas, but when I zoom, any 1px strokes increase in width (visually). Is there a svg setting that will ensure that 1px strokes remain 1px (visually) when zoomed? I remember reading about it somewhere, but can't find the resource.
Try to add vector-effect="non-scaling-stroke" attribute to the path. Check HERE for details. Im guessing that's what you want?

Horizontal scroll bar in IE6

I am getting a horizontal scroll bar in IE6. Attached the path to zip folder. Download and open index.html page in IE6. Let me know how to remove the scroll bar.IE6-horizontal-scroll bar
Its one or more bad values in paddings. Try replacing all "padding" with "xxx" for a moment and you'll see that the problem disappears.
You also need to study the broken box model on IE.
Solution:
Replace all padding: 10px with padding: 10px 0;
Fix what does not look right (padding wise)
You need to set the horizontal padding of div#container to zero too. You're only setting the top padding in skin-ie.css to zero now. Change padding-top: 0px in skin-ie.css to padding: 0 (the px is unnecessary for zero).
tried
html{
width:100%;
overflow-x: hidden;
}
body{
width:100%;
overflow-x: hidden;
}
yet?
EDIT:
This works but hides right side edge content. See the link screenshot. http://shivanand.in/temp/rightside-edges-hidden.gif – Shivanand
Hmm, that is weird. Are you using any position: absolute DIVs with width set in pixels (not %) that are causing this to happen?

Resources