- Directly view
external.svg
: https://raw.githubusercontent.com/gist/yawnoc/8f75508b298e7def04ecef2731bf983a/raw/9d37e32c74f60ab3220e1dc1842e590da68c4e7f/external.svg - View rendered
index.html
: https://htmlpreview.github.io/?https://gist.github.com/yawnoc/8f75508b298e7def04ecef2731bf983a/raw/9d37e32c74f60ab3220e1dc1842e590da68c4e7f/index.html
Last active
June 6, 2022 14:24
-
-
Save yawnoc/8f75508b298e7def04ecef2731bf983a to your computer and use it in GitHub Desktop.
SVG marker non-scaling-stroke: inline versus external
This file contains 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Inline vs img test</title> | |
</head> | |
<body> | |
<h2>Inline</h2> | |
<svg width="100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 5"> | |
<style> | |
line { | |
stroke: black; | |
vector-effect: non-scaling-stroke; | |
} | |
polyline { | |
fill: none; | |
} | |
</style> | |
<defs> | |
<marker id="plus" viewBox="-1 -1 2 2" | |
markerUnits="userSpaceOnUse" | |
refX="0" refY="0" markerWidth="2" markerHeight="2"> | |
<line x1="-1" y1="0" x2="1" y2="0"/> | |
<line x1="0" y1="-1" x2="0" y2="1"/> | |
</marker> | |
</defs> | |
<polyline points="1,1 4,1" | |
marker-start="url(#plus)" | |
marker-mid="url(#plus)" | |
marker-end="url(#plus)" | |
/> | |
<line x1="1" y1="4" x2="4" y2="4"/> | |
</svg> | |
<h2><code><img></code></h2> | |
<img alt="" src="external.svg" width="100"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment