Published at
Updated at
Reading time
This post is part of my Today I learned series in which I share all my web development learnings.

Today I came across the entry for vector-effect: non-scaling-stroke. Using vector-effect you can control if transformation such as scale should be applied to the stroke width, too. If you define vector-effect="non-scaling-stroke" you can guarantee that the stroke width stays the same no matter which transformations are applied. This functionality can be useful when you're building interactive SVG animations.

Learn more about it by playing with the demo below. You can change the scale value and find out that the stroke width scales on the x and y axis, too. Change vector-effect to non-scaling-stroke and see that the stroke width stays the same. 💪

Read more about vector-effect on MDN. Have fun and happy scaling!

Was this TIL post helpful?
Yes? Cool! You might want to check out Web Weekly for more quick learnings. The last edition went out 18 days ago.

Related Topics

Related Articles

About the author

Stefan standing in the park in front of a green background

Frontend nerd with over ten years of experience, "Today I Learned" blogger, conference speaker, Tiny helpers maintainer, and DevRel at Checkly.