I have a <map>
whose background
CSS property is set to a 400x400 image.
It has a number of <area>
regions, each of which points to some URL:
<map ...>
<area shape="rect" coords="5, 5, 10, 10" href="http://example.com/1">
<area shape="rect" coords="10, 20, 20, 30" href="http://example.com/2">
...
</map>
I would like to color some of the areas with a solid fill color so that they obscure the background image. I had assumed the <area>
would have a background, but this doesn't seem to work:
<map ...>
<!-- Adding `style="background-color: red"` has no effect. -->
<area shape="rect" coords="5, 5, 10, 10" href="http://example.com/1"
style="background-color: red">
<area shape="rect" coords="10, 20, 20, 30" href="http://example.com/2">
...
</map>
Is there a way to do this with CSS?
Edit: There are existing but not identical questions whose answers take a stab at this, but they either require using jQuery or don't use valid HTML. I'm asking for a CSS-based solution, if one exists.