Created
April 16, 2021 12:42
Svg overlap maps
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
<html> | |
<head> | |
<style> | |
.body { | |
background-color: green; | |
} | |
.source_container { | |
position: relative; | |
padding: 20px 20px; | |
background-color: red; | |
} | |
img.source_image { | |
width: 100%; | |
} | |
#overlay { | |
position: absolute; | |
top: 20px; | |
left: 20px; | |
bottom: 20px; | |
right: 20px; | |
} | |
</style> | |
</head> | |
<body class="body"> | |
<h2>Hello World</h2> | |
<div class = "source_container"> | |
<img class="source_image" src="https://squidex.autorox.co:8443/api/assets/b2c/8d279e5f-0b10-40a1-a4aa-37558cad6fdd" /> | |
<svg id="overlay" viewBox="0 0 526 361" xmlns="http://www.w3.org/2000/svg"> | |
<rect fill="rgba(0, 0, 0, 0.4)" x="0" y="0" width="100%" height="100%"></rect> | |
<!-- | |
with a large viewBox the circle looks small | |
as it is using user units for the r attribute: | |
4 resolved against 100 as set in the viewBox | |
--> | |
<polygon points="364,183 430,181 433,209 354,211" fill="blue"/> | |
</svg> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment