Skip to content

Commit 642429a

Browse files
committed
Add user guide section for text elements using DivIcon and Tooltip
1 parent 6c53153 commit 642429a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/user_guide/features.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,30 @@ Features
66

77
features/fit_overlays
88
features/click_related_classes
9+
10+
Text Elements
11+
=============
12+
13+
Folium supports several ways to display text on maps.
14+
15+
**1. DivIcon Labels**
16+
To add always-visible text labels on the map:
17+
18+
.. code-block:: python
19+
20+
from folium import Map, Marker, DivIcon
21+
22+
m = Map(location=[40.7128, -74.0060], zoom_start=13)
23+
Marker(
24+
location=[40.7128, -74.0060],
25+
icon=DivIcon(
26+
icon_size=(150,36),
27+
icon_anchor=(0,0),
28+
html='<div style="font-size: 12pt; color : black">Hello World!</div>',
29+
)
30+
).add_to(m)
31+
m.save("map.html")
32+
33+
**2. Tooltip and Popup Text**
34+
35+
Use tooltips for hover text or popups for clickable text.

0 commit comments

Comments
 (0)