Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SVG with square viewBox overflowing viewPort

A have a non-squared svg and need a square (unit) viewBox that may be overflowing the viewPort. What can I do? I tried all options of preserveAspectRatio, which didn’t work. Any other ideas would be much appreciated.

This is how it should be looking…

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You want

preserveAspectRatio="xMidYMid slice"

slice ensures that the all the viewport is visible within the viewBox.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading