diff --git a/src/mapml-viewer.js b/src/mapml-viewer.js index 7b49bd685..812794cd0 100644 --- a/src/mapml-viewer.js +++ b/src/mapml-viewer.js @@ -104,6 +104,7 @@ export class MapViewer extends HTMLElement { let mapDefaultCSS = document.createElement('style'); mapDefaultCSS.innerHTML = `:host {` + + `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140). `contain: content;` + // Contain layout and paint calculations within the map element. `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default. `overflow: hidden;` + // Make the map element behave and look more like a native element. diff --git a/src/web-map.js b/src/web-map.js index cf4ee6656..fa0b62969 100644 --- a/src/web-map.js +++ b/src/web-map.js @@ -111,6 +111,7 @@ export class WebMap extends HTMLMapElement { let mapDefaultCSS = document.createElement('style'); mapDefaultCSS.innerHTML = `map[is="web-map"] {` + + `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140). `contain: content;` + // Contain layout and paint calculations within the map element. `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default. `overflow: hidden;` + // Make the map element behave and look more like a native element.