I'm adding an overlaid box on an image so that the box's borders are interactable but pointer-events pass through its unfilled center. Reading MSDN I thought the phrase "experimental for HTML" meant modern browsers might run it for HTML:
MSDN pointer-events documentation:
visible
SVG only (experimental for HTML). The element can be the target of a pointer event when the visibility property is set to visible and e.g. the mouse cursor is over either the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill and stroke do not affect event processing.
So I tried:
#overlay {
position: absolute;
left: 50px;
top: 50px;
width: 200px;
height: 100px;
border-width: 2px;
border-color: lime;
border-style: solid;
pointer-events: visible;
}
#puppy:hover{
opacity: 0.5
}
<img id="puppy" src="https://live.staticflickr.com/4112/5170590074_714d36db83_b.jpg" />
<div id="overlay"></div>
But this fails. I then tried to get into creating and resizing SVG elements dynamically and somehow that appears to be a bit more complicated, having to update viewBoxes and setting namespaceURIs and such... Maybe it's not that bad but I'd really prefer to just use HTML, it leaves my code cleaner.