I'm trying to embed an external SVG, with an specific aspect ratio defined in the viewBox property. Im embedding the SVG via an img-tag. My intent is to let the SVG take all the width and take as much height as needed. for that I've set width: 100% on the img-tag. Sadly prince renders the img-tag perfectly squared (you can see that by setting a background-color). the svg is rendered with respect to the aspect ratio, but vertically and horizontally centered in the img-tag. regardless wether I use a portrait or landscape svg the img stays squared. This is a simpler example:
renders like the attached file. As to my understanding the svg height should be calculated by the viewBox and the given width and the blue area should not be visible. Am I wrong?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<svg style="background:blue;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50" width="100%" height="auto">
<rect x="0" y="0" width="100" height="50" fill="green"/>
</svg>
</body>
</html>
renders like the attached file. As to my understanding the svg height should be calculated by the viewBox and the given width and the blue area should not be visible. Am I wrong?