Juan C
Juan C

Reputation: 6132

Remove scrollbar from folium map in Python

I recently started working with folium which is a bit web developer oriented and I'm not. So I created a map and injected a title onto it, like this:

m = folium.Map(location=loc,
       center=center, zoom_start=13)

title_html = '''
     <h3 align="center" style="font-size:20px"><b>Titly title</b></h3>
     ''' 
m.get_root().html.add_child(folium.Element(title_html))
display(m)

enter image description here

But this creates a scrollbar, which makes navigating a bit uncomfortable. Before adding the title I had no problems, as you can see:

enter image description here

So, is there any way to add a title without adding a scrollbar?

Thanks!

Upvotes: 3

Views: 1315

Answers (1)

Barbaros &#214;zhan
Barbaros &#214;zhan

Reputation: 65288

It's related to the html's style properties which is mostly stated between the <head></head> tags. So yo can convert the variable title_html as below :

title_html = '''
     <head><style> html { overflow-y: hidden; } </style></head>
     <h3 align="center" style="font-size:20px"><b>Titly title</b></h3>
     ''' 

Upvotes: 2

Related Questions