制作工具提示换行文字

时间:2017-01-04 10:46:37

标签: leaflet

我无法弄清楚如何将文本包装在传单工具提示上。我不想显示标记,所以它隐藏,但我想文本将文本包装在工具提示中,如果可能的话

# If enabled, outputs something like this:
# rewrite_module (shared)
apachectl -M | grep rewrite # It's apache2ctl on some platforms

# If not enabled; you can enable it using this on most platforms: 
a2enmod rewrite
apachectl restart

然后添加到地图中,我已经改变了无包装的属性,但似乎没有任何效果。此外,由于某种原因,背景颜色似乎正在改变,但那是一个不同的问题

.myTooltip {
  background: green;
  border: 2px solid cyan
}

.leaflet-tooltip-left.myTooltip::before {
  border-left-color: cyan;
}
.leaflet-tooltip-right.myTooltip::before {
  border-right-color: red;
}

enter image description here

1 个答案:

答案 0 :(得分:3)

您需要覆盖white-space类的leaflet-tooltip属性。此外,您也可以设置工具提示的width

只需在leaflet.css文件

之后添加此内容即可
.leaflet-tooltip{
    width: 100px;
    white-space: normal;
}

Here是一个有效的例子

相关问题