Course lesson

Replace the Marker with Custom HTML and Style with CSS

Not only can we use the Leaflet Icon instance to add a custom image, we can create completely custom HTML! This opens the door to a lot of possibilities that you can't do with only an image like using CSS to add effects.

Duration
2 min
Access
Pro
Transcript
Available

Not only can we use the Leaflet Icon instance to add a custom image, we can create completely custom HTML! This opens the door to a lot of possibilities that you can't do with only an image like using CSS to add effects.

For this extra credit, use a different Leaflet icon type called DivIcon to transform our markers into custom HTML, which you can then style with CSS.

Click here for exercise instructions