Thanks again Mark!
While folks can easily dig in, please allow me to articulate here on the forum my understanding (mostly to learn myself, and sorry if this is crowding space!).
The CSS contributions to which you are pointing our attention are those that affect the map’s rendering to a stand-alone HTML page view. This CSS is applied within the page source (i.e. visible when clicking ‘view source’). It does not come via the notebook. This is the CSS style element that responds to it:
<style media="screen">
body {
padding: 0;
margin: 0;
}
html, body, #all, #observablehq-map_container {
height: 100%;
width: 100vw;
}
#all {
position: relative
}
#observablehq-map_container, #observablehq-elevation_chart_container {
position: absolute
}
#observablehq-elevation_chart_container {
z-index: 1000;
bottom: 0
}
</style>
Without this adjustment, the map would render like this:
https://observablehq.com/embed/@mcmcclur/gpx-rides-with-leaflet?cells=map_container
… So definitely this full screen view is an improvement
Within the notebook, however, you have further CSS definitions: These definitions allow you to control the look and feel of the map icons. [I initially thought that you were calling attention to these styling elements (rather than the embed code); apologies for not being clear on this earlier!]
What your embed code teaches is that you are you are able to separate out how you control the map rendering within Observable and without it. The way you construct your map <div>
container within the notebook is the ‘secret sauce’:
map_container = {
let container = d3
.create("div")
.style("width", "100%")
.style("height", h);
yield container.node();
}
… If I am reading this correctly, what this does is to tell the map always to fill the full width of the <div>
it which it lives. This bit of CSS in the container’s construction is important, and it does carry into the embedded notebook. Your in-page style definitions simply ‘elaborate’ on this, so to speak, by asking also that your height extends 100% so that you get a full page map view.
I think I am getting it?
…Within your map are so many smooth and beautiful features, including the ‘select’ and ‘zoom to’ dimensions. These are not controlled by CSS. (Lots to learn here, thanks for sharing).
I really enjoy seeing this and learning! Thanks for your time and for all the examples. Apologies that I am slow to understand. More reading ahead! [I’ve faltered lots before on getting maps to embed and still look nice, so I’m very interested]
Thanks again!