So, I only recently got into SVG, and I had problems with the password related to the fact that instead of resizing the container, my SVG image is cut out.
HTML:
<!DOCTYPE html> <html> <head> <title>Eye</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="js/snap.svg.js"></script> <script src="js/eye.js"></script> </head> <body> <svg id="svg"></svg> </body> </html>
JS:
window.onload = function() { var s = Snap("#svg"); var circle = s.circle(90,120,80); var square = s.rect(210,40,160,160); var ellipse = s.ellipse(460,120,50,80); }
Jsfiddle
Now, with this CSS code, it certainly won't be cropped anymore, since the user-agent stylesheet in Google Chrome contains "overflow: hidden" in relation to SVG. But is this really the right way to resolve this issue? Also, why is it cropped and not scaled? Should I "draw" my svgs using percentages instead of pixels?
source share