Svg Icon displayed only half size - html

So I have a navbar that uses svg icons. I tried to replace an icon but I can't seem to find the right size/shape.
This is the svg code from the icon that works:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="62px"
viewBox="0 0 32 62" enable-background="new 0 0 32 62" xml:space="preserve">
<title>icon-2</title>
<desc>Created with Sketch.</desc>
<path id="Shape" sketch:type="MSShapeGroup" fill="#FFFFFF" d="M31,30H1c-0.6,0-1-0.4-1-1V6c0-0.6,0.4-1,1-1h9.1C10.6,2.2,13,0,16,0
s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,29.6,31.6,30,31,30L31,30z M16,2c-1.9,0-3.4,1.3-3.9,3h7.7C19.4,3.3,17.9,2,16,2L16,2z
M30,7H2v6h28V7L30,7z M14.3,15c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,15z M30,15H19.9c-0.4,1.7-2,3-3.9,3
s-3.4-1.3-3.9-3H2v13h28V15L30,15z"/>
<path id="Shape_1_" sketch:type="MSShapeGroup" fill="#FFFFFF" d="M31,62H1c-0.6,0-1-0.4-1-1V38c0-0.6,0.4-1,1-1h9.1
c0.5-2.8,2.9-5,5.9-5s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,61.6,31.6,62,31,62L31,62z M16,34c-1.9,0-3.4,1.3-3.9,3h7.7
C19.4,35.3,17.9,34,16,34L16,34z M30,39H2v6h28V39L30,39z M14.3,47c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,47z M30,47
H19.9c-0.4,1.7-2,3-3.9,3s-3.4-1.3-3.9-3H2v13h28V47L30,47z"/>
</svg>
This is how the navbar looks, if it helps:
I'm not sure about the size, maybe that's why I get it wrong, however, I tried with 32x32p and 64x64p. Thanks, any answer is welcome
Here is a .css snippet of my navbar icons: https://pastebin.com/7TqJU6yc. Here is my .js code for the animation, if it has anything to do with it: pastebin.com/jCcvEuA4 and lastly a little bit of HTML, however it doesn't really involve the icons much: pastebin.com/RydBqfHB. A little bit of backstory: The icon is set as a <li> background. That's why I thought the size myght be the issue here, or the icon itself, however it doesn't seem the case.
Also, here is a little screenshot with a replaced icon, to help understand the problem: imgur.com/a/LW7sdIZ (notice the home icon)

For clarity, the regulation of the location of the icon relative to the SVG canvas, you can apply the style
style="border:1px solid red;"
The red frame around the icons is the canvas svg
To make the icons visible, I added fill="black"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32px" height="62px"
viewBox="0 0 32 62" style="border:1px solid red;">
<title>icon-2</title>
<desc>Created with Sketch.</desc>
<path id="Shape" sketch:type="MSShapeGroup" fill="black" d="M31,30H1c-0.6,0-1-0.4-1-1V6c0-0.6,0.4-1,1-1h9.1C10.6,2.2,13,0,16,0
s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,29.6,31.6,30,31,30L31,30z M16,2c-1.9,0-3.4,1.3-3.9,3h7.7C19.4,3.3,17.9,2,16,2L16,2z
M30,7H2v6h28V7L30,7z M14.3,15c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,15z M30,15H19.9c-0.4,1.7-2,3-3.9,3
s-3.4-1.3-3.9-3H2v13h28V15L30,15z"/>
<path id="Shape_1_" sketch:type="MSShapeGroup" fill="#black" d="M31,62H1c-0.6,0-1-0.4-1-1V38c0-0.6,0.4-1,1-1h9.1
c0.5-2.8,2.9-5,5.9-5s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,61.6,31.6,62,31,62L31,62z M16,34c-1.9,0-3.4,1.3-3.9,3h7.7
C19.4,35.3,17.9,34,16,34L16,34z M30,39H2v6h28V39L30,39z M14.3,47c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,47z M30,47
H19.9c-0.4,1.7-2,3-3.9,3s-3.4-1.3-3.9-3H2v13h28V47L30,47z"/>
</svg>
If you want to show only one icon, you must specify width="32" height="32" viewBox="0 0 32 32"
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="32" height="32" viewBox="0 0 32 32" style="border:1px solid red;">
<title>icon-2</title>
<desc>Created with Sketch.</desc>
<path id="Shape" sketch:type="MSShapeGroup" fill="black" d="M31,30H1c-0.6,0-1-0.4-1-1V6c0-0.6,0.4-1,1-1h9.1C10.6,2.2,13,0,16,0
s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,29.6,31.6,30,31,30L31,30z M16,2c-1.9,0-3.4,1.3-3.9,3h7.7C19.4,3.3,17.9,2,16,2L16,2z
M30,7H2v6h28V7L30,7z M14.3,15c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,15z M30,15H19.9c-0.4,1.7-2,3-3.9,3
s-3.4-1.3-3.9-3H2v13h28V15L30,15z"/>
<path id="Shape_1_" sketch:type="MSShapeGroup" fill="#black" d="M31,62H1c-0.6,0-1-0.4-1-1V38c0-0.6,0.4-1,1-1h9.1
c0.5-2.8,2.9-5,5.9-5s5.4,2.2,5.9,5H31c0.6,0,1,0.4,1,1v23C32,61.6,31.6,62,31,62L31,62z M16,34c-1.9,0-3.4,1.3-3.9,3h7.7
C19.4,35.3,17.9,34,16,34L16,34z M30,39H2v6h28V39L30,39z M14.3,47c0.3,0.6,1,1,1.7,1c0.7,0,1.4-0.4,1.7-1H14.3L14.3,47z M30,47
H19.9c-0.4,1.7-2,3-3.9,3s-3.4-1.3-3.9-3H2v13h28V47L30,47z"/>
</svg>

Related

SVG image as a cursor pixcelated

I'm using this custom size 64*64 plus icon svg as zoom icon as a cursor in my website. As you can see, it's pixcelated. Specially the white border. Don't know why. Because it's svg it suppose to looks sharp right?
I tried everything.
Increasing border width.
Increasing size.
Set shape-rendering="auto"
None of above working.
Here is my svg code
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg width="64px" height="64px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-285 377 40 40" style="enable-background:new -285 377 40 40;" xml:space="preserve" shape-rendering="auto">
<style type="text/css">
.st0{fill:none;}
.st1{opacity:0.8;fill:none;stroke:#FFFFFF;stroke-width:3;stroke-miterlimit:10;enable-background:new ;}
</style>
<title>zoom_icon</title>
<g>
<title>background</title>
<rect id="canvas_background" x="-286" y="376" class="st0" width="12.6" height="12.6"/>
</g>
<g>
<title>Layer 1</title>
<g id="Layer_2_1_">
<g id="Layer_1-2">
<circle id="svg_1" shape-rendering="geometricPrecision" class="st1" cx="-264.8" cy="397.2" r="18"/>
<line id="svg_2" class="st1" x1="-264.8" y1="386.7" x2="-264.8" y2="407.7"/>
<line id="svg_3" class="st1" x1="-254.3" y1="397.2" x2="-275.3" y2="397.2"/>
</g>
</g>
</g>
</svg>
Here is my the svg file: https://svgshare.com/i/H_C.svg
Here is the real world example. Jsfiddle
What course to pixcelated this image?
you can try removing the circle and just use a border:
.plus {
border: solid white 1px;
border-radius: 50%;
}

How could I remove empty spaces between the cloud and the border?

svg {
border: 1px solid #000;
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<path fill="red" fill-rule="evenodd" clip-rule="evenodd" d="M43.945,65.639c-8.835,0-15.998-7.162-15.998-15.998
c0-8.836,7.163-15.998,15.998-15.998c6.004,0,11.229,3.312,13.965,8.203c0.664-0.113,1.338-0.205,2.033-0.205
c6.627,0,11.999,5.373,11.999,12c0,6.625-5.372,11.998-11.999,11.998C57.168,65.639,47.143,65.639,43.945,65.639z M59.943,61.639
c4.418,0,8-3.582,8-7.998c0-4.418-3.582-8-8-8c-1.6,0-3.082,0.481-4.333,1.291c-1.231-5.316-5.974-9.29-11.665-9.29
c-6.626,0-11.998,5.372-11.998,11.999c0,6.626,5.372,11.998,11.998,11.998C47.562,61.639,56.924,61.639,59.943,61.639z"/>
</svg>
-5.372,11.998-11.999,11.998C57.168,65.639,47.143,65.639,43.945,65.639z M59.943,61.639
c4.418,0,8-3.582,8-7.998c0-4.418-3.582-8-8-8c-1.6,0-3.082,0.481-4.333,1.291c-1.231-5.316-5.974-9.29-11.665-9.29
c-6.626,0-11.998,5.372-11.998,11.999c0,6.626,5.372,11.998,11.998,11.998C47.562,61.639,56.924,61.639,59.943,61.639z"/>
I still don't know how would you like it so I've made 2 versions
svg{border:1px solid;}
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100" height="72,73" viewBox="27.946 33.642 44 32" >
<path id="test" fill="red" fill-rule="evenodd" clip-rule="evenodd" d="M43.945,65.639c-8.835,0-15.998-7.162-15.998-15.998
c0-8.836,7.163-15.998,15.998-15.998c6.004,0,11.229,3.312,13.965,8.203c0.664-0.113,1.338-0.205,2.033-0.205
c6.627,0,11.999,5.373,11.999,12c0,6.625-5.372,11.998-11.999,11.998C57.168,65.639,47.143,65.639,43.945,65.639z M59.943,61.639
c4.418,0,8-3.582,8-7.998c0-4.418-3.582-8-8-8c-1.6,0-3.082,0.481-4.333,1.291c-1.231-5.316-5.974-9.29-11.665-9.29
c-6.626,0-11.998,5.372-11.998,11.999c0,6.626,5.372,11.998,11.998,11.998C47.562,61.639,56.924,61.639,59.943,61.639z"/>
</svg>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100" height="100" viewBox="27.946 27.642 44 44" >
<use xlink:href="#test" />
</svg>
How did I do it: I've used the method getBBox() for the cloud path. This method returns the size and position of the bounding box of a path. I've used this data to change the value for the viewBox attribute.
svg {
border: 1px solid #000;
}
<svg width="43.994999" height="31.996" xmlns="http://www.w3.org/2000/svg">
<path fill="red" fill-rule="evenodd" clip-rule="evenodd" d="m15.997999,31.996c-8.835,0 -15.998,-7.162 -15.998,-15.998c0,-8.836 7.163,-15.998 15.998,-15.998c6.004,0 11.229,3.312 13.965,8.203c0.664,-0.113 1.338,-0.205 2.033,-0.205c6.627,0 11.999,5.373 11.999,12c0,6.625 -5.372,11.998 -11.999,11.998c-2.775,0 -12.8,0 -15.998,0zm15.998,-4c4.418,0 8,-3.582 8,-7.998c0,-4.418 -3.582,-8 -8,-8c-1.6,0 -3.082,0.481 -4.333,1.291c-1.231,-5.316 -5.974,-9.29 -11.665,-9.29c-6.626,0 -11.998,5.372 -11.998,11.999c0,6.626 5.372,11.998 11.998,11.998c3.617,0 12.979,0 15.998,0z"/>
</svg>

How do I control the spacing around my external svg

How can I control the position and space around my .svg. Right now when the page renders I get all this space around to the right and bottom of the .svg?
My markup and styling looks like such:
<style>
.fill-extra { fill: #686868; }
</style>
In the <body> I have:
<svg class="fill-extra" width="150" height="150" viewBox="0 0 100 100">
<use xlink:href="svg_icons/extra_closed.svg#Layer_1"></use>
</svg>
the svg looks like this
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
enable-background="new 0 0 49.68 49.68" xml:space="preserve">
<path d="M48.998,24.754c0,13.408-10.87,24.279-24.279,24.279c-13.41,0-24.279-10.871-24.279-24.279
c0-13.409,10.87-24.279,24.279-24.279C38.128,0.475,48.998,11.345,48.998,24.754z M24.715,38.347h13.527l4.445-17.837l-1.871-3.976
h-1.641l-0.467,2.572H24.715h-13.99l-0.466-2.572H8.62l-1.871,3.976l4.445,17.837H24.715z M24.717,28.697h4.93l1.666-1.053V23.96
h-1.754v2.456h-4.842H19.88V23.96h-1.755v3.685l1.667,1.053H24.717z M24.717,17.074h12.209v-3.07H24.717H12.51v3.07H24.717z
M24.717,11.942h7.999V9.837h-7.999h-7.996v2.105H24.717z"/>
</svg>
Your viewBox is from 0,0 to 100,100 but the path's bounds are roughly 0,0 to 50,50.
You could make the viewBox smaller e.g. viewBox="0 0 50 50" which would keep the drawing the same size but make the contents look bigger. Or you could also make the width and height smaller which in conjunction with adjusting the viewBox dimensions could keep the drawing the same size whilst also getting rid of the empty space round it.

Applying CSS from a file to a SVG file through HTML

Good Evening,
I have multiple SVG files and need to dynamically change their fill color. Preferably using CSS.
HTML:
<div>
<svg width="100%" height="100%" viewbox="0 0 64 64" preserveAspectRatio="xMinYMin meet">
<image xlink:href="http://imgh.us/export_1.svg" width="64" height="64" />
</svg>
</div>
CSS:
div {
width: 64px;
height: 64px;
}
svg, svg * {
fill: #000000 !important;
}
SVG:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="72.121px" height="59.209px" viewBox="0 0 72.121 59.209" enable-background="new 0 0 72.121 59.209" xml:space="preserve">
<g>
<path fill="#ff0000" d="M71.53,36.664L57.56,22.705c-0.57-0.57-1.43-0.74-2.18-0.43c-0.74,0.31-1.23,1.04-1.23,1.84v5.59h-4.32
v-12.6c0-0.53-0.22-1.05-0.609-1.43L33.6,0.564c-0.22-0.21-0.47-0.36-0.75-0.45c-0.1-0.04-0.2-0.06-0.31-0.08
c-0.06-0.01-0.12-0.02-0.18-0.02h-0.08c-0.06-0.01-0.13-0.01-0.19-0.01H2c-1.1,0-2,0.89-2,2v55.2c0,1.11,0.9,2,2,2h45.83
c1.101,0,2-0.89,2-2v-10.75h4.32v5.591c0,0.81,0.49,1.54,1.23,1.85c0.25,0.1,0.51,0.15,0.77,0.15c0.521,0,1.03-0.2,1.41-0.58
l13.97-13.971c0.38-0.38,0.59-0.88,0.59-1.409C72.12,37.545,71.91,37.045,71.53,36.664z M45.83,55.204H4v-51.2h26.21v13.1
c0,1.11,0.89,2,2,2h13.62v10.6H34.91c-1.1,0-2,0.9-2,2v12.75c0,1.11,0.9,2,2,2H45.83V55.204z"/>
<path fill="#ff0000" d="M32.28,0.015c-0.06-0.01-0.13-0.01-0.19-0.01h0.12C32.23,0.004,32.26,0.015,32.28,0.015z"/>
</g>
<g>
<path fill="#ff0000" d="M32.21,0.004h-0.12c0.06,0,0.13,0,0.19,0.01C32.26,0.015,32.23,0.004,32.21,0.004z"/>
</g>
</svg>
Here's a fiddle.
My problem is simple. Instead of the fill color in the CSS, the SVG-files fill color is used. Which makes sense, since it's a different document.
For various reasons I can not edit the SVG files.
Is there a solution and what would it look like?
If you want to use the SVG and Image tag alone you'll need to use javascript to manipulate/recreate the image to use the filters/colors/css:
How to change color of SVG image using CSS (jQuery SVG image replacement)?
If you want to use pure CSS you need to embed the SVG directly in the page.

Changing fill to svg with <use>

I'm trying to load in my HTML, the colors that are set in the .svg file with <use> but for some reason it doesn't load.
HTML
<svg>
<use xlink:href="img/beer-05.svg#beer"></use>
</svg>
beer-05.svg
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<style type="text/css">
#beer1 {fill:#ffc32e;}
#beer2 {fill:#f2a33a;}
#beer3 {fill:#fffade;}
#beer4 {fill:#ffffff;}
#beer1:hover {fill:green;}
</style>
<symbol id="beer" viewBox="0 0 32 32">
<path id="beer1" d="M19.8,17.5v2.4v2.4v1.4v1v3.8V44h8.5c3,0,5.4-2.4,5.4-5.4V28.5v-3.8v-1v-1.4v-2.4v-2.4H19.8z"/>
<path id="beer2" d="M5.9,15.2v4.8v3.8v1v3.8v10.2c0,3,2.4,5.4,5.4,5.4h8.5V28.5v-3.8v-1v-3.8v-4.8H5.9z" />
<rect x="19.8" y="14.2" fill="none" width="13.9" height="4.8"/>
<path id="beer3" fill="#FFFADE" d="M9.4,38.5L9.4,38.5c-0.6,0-1-0.5-1-1V24c0-0.6,0.5-1,1-1h0c0.6,0,1,0.5,1,1v13.5
C10.4,38.1,9.9,38.5,9.4,38.5z"/>
<path id="beer4" fill="#FFFFFF" d="M35.3,18.5c-0.2,0-0.4,0-0.6,0v-0.2c0-0.4,0-0.8-0.1-1.2c2.1-1.7,3.1-4.2,2.3-6.3c-0.4-1.1-1.2-2-2.3-2.6
c-0.9-2.1-3.2-3.9-6.2-4.6c-1.6-0.4-3.2-0.4-4.5-0.1c-1.3-1-3.2-1.5-5.2-1.4c-2.6,0.2-4.7,1.4-5.7,3c-0.6,0-1.3,0-2,0.1
c-5.2,0.6-9.1,4.3-8.6,8.3c0.2,1.7,1.2,3.2,2.6,4.3c0,0.2,0,0.4,0,0.6v20.3c0,3.5,2.9,6.4,6.4,6.4h17c3.5,0,6.3-2.8,6.4-6.3
c0.2,0,0.4,0,0.6,0c4.5,0,8.2-4.5,8.2-10.1S39.8,18.5,35.3,18.5z M32.7,38.1v0.5c0,2.4-2,4.4-4.4,4.4h-17c-2.4,0-4.4-2-4.4-4.4
V18.8c1.7,0.7,3.6,1,5.7,0.7c1.6-0.2,3.1-0.7,4.4-1.4c1.9,2.2,5.1,3.5,8.8,3.3c2.8-0.2,5.2-1.2,6.9-2.8v0.5V38.1z M35.3,35.2
c-0.2,0-0.4,0-0.6-0.1v-13c0.2,0,0.4-0.1,0.6-0.1c2.5,0,4.7,3,4.7,6.6S37.8,35.2,35.3,35.2z"/>
</symbol>
could someone help me with this?
As defined in the specs, you can't address <use> elements via CSS.
CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree because its contents are not part of the formal document structure.
Check this answer.
In your case, I would embed the external svg with <object> , after altering the external svg file to look like:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="280" viewBox="0 0 32 32" preserveAspectRatio="xMinYMin meet">
<defs>
<style type="text/css">
#beer1 {fill:#ffc32e;}
#beer2 {fill:#f2a33a;}
#beer3 {fill:#fffade;}
#beer4 {fill:#ffffff;}
#beer1:hover {fill:green;}
</style>
</defs>
<path id="beer1" d="M19.8,17.5v2.4v2.4v1.4v1v3.8V44h8.5c3,0,5.4-2.4,5.4-5.4V28.5v-3.8v-1v-1.4v-2.4v-2.4H19.8z"/>
<path id="beer2" fill="#f2a33a" d="M5.9,15.2v4.8v3.8v1v3.8v10.2c0,3,2.4,5.4,5.4,5.4h8.5V28.5v-3.8v-1v-3.8v-4.8H5.9z" />
<rect x="19.8" y="14.2" fill="none" width="13.9" height="4.8"/>
<path id="beer3" fill="#FFFADE" d="M9.4,38.5L9.4,38.5c-0.6,0-1-0.5-1-1V24c0-0.6,0.5-1,1-1h0c0.6,0,1,0.5,1,1v13.5
C10.4,38.1,9.9,38.5,9.4,38.5z"/>
<path id="beer4" fill="#FFFFFF" d="M35.3,18.5c-0.2,0-0.4,0-0.6,0v-0.2c0-0.4,0-0.8-0.1-1.2c2.1-1.7,3.1-4.2,2.3-6.3c-0.4-1.1-1.2-2-2.3-2.6
c-0.9-2.1-3.2-3.9-6.2-4.6c-1.6-0.4-3.2-0.4-4.5-0.1c-1.3-1-3.2-1.5-5.2-1.4c-2.6,0.2-4.7,1.4-5.7,3c-0.6,0-1.3,0-2,0.1
c-5.2,0.6-9.1,4.3-8.6,8.3c0.2,1.7,1.2,3.2,2.6,4.3c0,0.2,0,0.4,0,0.6v20.3c0,3.5,2.9,6.4,6.4,6.4h17c3.5,0,6.3-2.8,6.4-6.3
c0.2,0,0.4,0,0.6,0c4.5,0,8.2-4.5,8.2-10.1S39.8,18.5,35.3,18.5z M32.7,38.1v0.5c0,2.4-2,4.4-4.4,4.4h-17c-2.4,0-4.4-2-4.4-4.4
V18.8c1.7,0.7,3.6,1,5.7,0.7c1.6-0.2,3.1-0.7,4.4-1.4c1.9,2.2,5.1,3.5,8.8,3.3c2.8-0.2,5.2-1.2,6.9-2.8v0.5V38.1z M35.3,35.2
c-0.2,0-0.4,0-0.6-0.1v-13c0.2,0,0.4-0.1,0.6-0.1c2.5,0,4.7,3,4.7,6.6S37.8,35.2,35.3,35.2z"/>
</svg>
Edit from the comments below :
You can access each item separately, the same way <use xlink:href> does :
<object type="image/svg+xml" data="http://epoje.es/beers.svg#cervey"></object>