13:59
0
Q: Keeping aspect ratio of internal SVG

ShtoleI have a root SVG element, defined as this (inserted at the top of the <body>): <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="svg-library"> <defs> <symbol id="image1" viewBox="-10 0 828 1000"> <path fill="curren...

Have you tried giving the use element a viewBox attribute?
Hello @RobertLongson, I want the viewBox to be defined just once for sake of DRY.
But you also want it to work, no? Which do you want more?
Hello @Inspiraller, if I set just CSS height property, the result is the same as setting width to auto.
Note that using <use> to avoid multiple copies i.e. DRY is usually a terrible idea. Performance of <use> is miserable because its purpose is to keep the contents of multiple instances in sync when they change.
13:59
@RobertLongson No, I don't work the code to “just work”. I want it to be correct. I could just calculate width value myself and set it to 3.312rem. But the next time the image1 changes, the whole layout is broken.
Then you may need to use javascript to get the viewBox attribute value from the symbol and copy it to the use element. Or just make a comment in the markup to update it manually.
@RobertLongson I'd like to avoid using JS if possible. The point on performance is valuable, thank you, but right now I prefer normalization over speed.
Well the only solution is a viewBox on the use element so now what?
14:19
I still hope it's possible somehow in pure CSS/HTML ))