Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenLayers - HTML DIV overlay

Tags:

openlayers

I'm using OpenLayers to display a map on a standard HTML page, and I want to create a div that sits on top of the map. However, the div always seems to be obscured by the map tiles.

I believe there is a way to add elements to the map itself, but in this case that isn't a viable option since the div will potentially float partially over the map, and partially over other page elements.

<div id="maphost" style="width: 100%; height: 100%" />
<div id="overlay" />

That is the basic HTML. What CSS values do I need to add to either DIV to make this possible?

like image 706
Barguast Avatar asked Aug 10 '11 12:08

Barguast


2 Answers

add a z-index

<div id="maphost" style="width:100%; height:100%; z-index: 0"></div>
<div id="overlay" style="z-index:9999"></div>
like image 93
Ilia Choly Avatar answered Sep 28 '22 07:09

Ilia Choly


Another internal method for doing it is to use this css:

div.olMapViewport {
     z-index: 0;
}
like image 26
the_skua Avatar answered Sep 28 '22 05:09

the_skua