OpenLayers comes with a default stylesheet that contains the following CSS
div.olMap {
margin: 0 !important;
}
This is overriding your inline css margin-right: auto
, margin-left: auto
, and margin-top: 10%
.
You can fix this by applying your preferred styles to the #map
selector in an external style sheet (or internal).
#map {
margin-left: auto !important;
margin-right: auto !important;
margin-top: 10% !important;
}
This works because your reference to an ID'ed selector, #map
, has a higher priority than the class'ed selector, .olMap
.