I have a simple HTML5 page displaying a (rather large) layout image, containing a bunch of numbered boxes. Based on a select element, I would like to show a red hollow box on the specific numbered box on the image.
This is what I have so far:
<div data-role="content" style="scrolling: scroll; position: relative;">
<div style="float:left; position: absolute; border: 2px solid red; left: 154px; top: 52px; width: 20px; height: 20px;"></div>
<img alt="Floor Plan" src="../common/images/floorplan.jpg" width="100%" />
</div>
Resulting in the following image:
I guess I can prepopulate the coordinates of each numbered box and the width and height of each box in a javascript array, and then based on the select list, I can dynamically change the corresponding CSS elements for the box div. What has me stumped however is, when the browser is resized, the image automatically scales down (I am using Firefox, but I guess this is pretty common in most browsers), but the box would not scale with it.
How can I solve this issue, preferably with CSS? Any other solution welcome as well. Thanks in advance.