2024-05-19 01:18:01 发布
网友
我在为地图可视化而工作。你知道如何将弹出窗口的背景颜色从白色改为其他颜色吗?在
从这里How can I change the background color of a Leaflet popup?我知道这可能直接在传单上,但我发现任何与叶有关的东西!在
谢谢你!在
选项1(手动):
用编辑器软件打开您的.html文件,并在<style>标记中粘贴以下内容:.leaflet-popup-content-wrapper {background-color:black; color:white}
.html
<style>
.leaflet-popup-content-wrapper {background-color:black; color:white}
选项2(自动化):
创建地图并将其保存在path中。 然后使用BeautifulSoup。在
path
BeautifulSoup
from bs4 import BeautifulSoup path = 'your/path/map.html' soup = BeautifulSoup(open(path), "html.parser") head = soup.head head.append(soup.new_tag('style', type='text/css')) head.style.append(' .leaflet-popup-content-wrapper {background-color:black; color:white}') with open(path, "w") as file: file.write(str(soup))
选项1(手动):
用编辑器软件打开您的
.html
文件,并在<style>
标记中粘贴以下内容:.leaflet-popup-content-wrapper {background-color:black; color:white}
选项2(自动化):
创建地图并将其保存在
path
中。 然后使用BeautifulSoup
。在相关问题 更多 >
编程相关推荐