dlearman1
asked on
Can I use the clamp function to scale an SVG image.
I would like to scale an svg image using the clamp function. Something like this:
<div class="l-wrapper-page">
<a class="l-wrapper-page__logo" href="#"><img src="./_img/graphics/logos/serena-logo-sm.svg" width="clamp(140px, calc((#{.06544vw + 75.07853})) * 1px, 240px)" height="auto" alt="Serena Construction Logo">
</a>
</div>
I've tried a few tweaks to the code, but nothing seems to work. Looking up clamp it is supposed to work wherever a length is called for. Is there a reason this application doesn't work: relating to SVG or clamp specs? Is there a way to modify the code so it will work?
I just use width='nnpx' and the web browser automatically scales the SVG image to fit. It even works with percentages.
ASKER
Dave thanks for your input.
If possible, I'm looking for a dynamic solution that scales with viewer width. If I'm understanding you correctly, your solution would be static.
If possible, I'm looking for a dynamic solution that scales with viewer width. If I'm understanding you correctly, your solution would be static.
No, defining 'width' in percent is always dynamic.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK I'll give it a try. Thanks