walkermatt / ol-layerswitcher

Layer control for OpenLayers
MIT License
387 stars 176 forks source link

Modifying font #405

Closed minorsecond closed 3 years ago

minorsecond commented 3 years ago

Please forgive me if this is a simple question as I am a HTML & JavaScript newbie. How would one go about changing the font? This library is awesome, and I was able to quickly put together map using it, but I can't figure out what HTML (I assume?) to write to change the font.

minorsecond commented 3 years ago

I figured it out, if anyone sees this in the future. You have to go into the css file located at ./node_modules/ol-layerswitcher/dist. In my case, I wanted to modify the typeface for the layer names, so I added font-family: Helvetica; under .layer-switcher li label.

walkermatt commented 3 years ago

@minorsecond Hi, you shouldn't need to edit ol-layerswitcher.css in order to specify the font-family.

If you include your CSS file after you import ol-layerswitcher.css then you can override the layer switcher styles.

ol-layerswitcher.css doesn't actually define a font-family so the layer switcher will inherit the font from it's parent. For instance you could set the font-family for the body:

body {
  font-family: Helvetica;
}