When I have the width style of an image defined to be 100% of the parent then the image does not overflow. But, when I define the max-width to be 100% of the parent then it overflows. Here is my simplest working example:
The HTML:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Image Test</title>
</head>
<body style = "width: 70%; min-width: 400px; margin: 0 auto; background-color: #19747E">
<header style = "background-color: #A9D6E5">
</header>
<main style = "background-color: #A9D6E5; width: 100%">
<img src="square.svg" max-width = "100%">
</main>
<footer>
</footer>
</body>
</html>
The SVG:
<svg version="1.1" width="1902" height="439" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="1902" height="439" fill="blue" rx="20" ry="20"/>
</svg>
Why's it do this? My main issue is I have an image that is sometimes bigger than the parent; and when the image is smaller than the parent I don't want it to stretch the image so setting width to 100% is not an option.
style="max-width:100%"