Last active
March 11, 2018 20:36
-
-
Save lightjs/5372867 to your computer and use it in GitHub Desktop.
SVG resize with non-scaling-stroke value for vector-effect attribute avoiding deformation on path stroke (cross browser)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>SVG resize</title> | |
<style> | |
div, svg { | |
width:100%; | |
height:100%; | |
} | |
text { | |
font-family: 'Helvetica Neue', Verdana; | |
font-weight: 100; | |
font-size: 22px; | |
text-anchor: middle; | |
} | |
</style> | |
</head> | |
<body> | |
<div> | |
<svg> | |
<path d="M10,20L40,100L39,200z" stroke="black" stroke-width="2px" fill="none"></path> | |
<text transform="translate(50,240)">normal</text> | |
<path transform="translate(100,0)scale(4,1)" d="M10,20L40,100L39,200z" stroke="black" stroke-width="2px" fill="none"></path> | |
<text transform="translate(240,240)scale(4,1)">scaled</text> | |
<path vector-effect="non-scaling-stroke" transform="translate(300,0)scale(4,1)" d="M10,20L40,100L39,200z" stroke="black" stroke-width="2px" fill="none"></path> | |
<text transform="translate(450,240)">fixed</text> | |
</svg> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment