首页 > 解决方案 > 如何更改谷歌地图 mapType 控制器的字体大小?

问题描述

我可以更改谷歌地图 mapType 控制器的大小,但不能更改字体大小。是否可以通过 html 或 css 更改字体大小?

在此处输入图像描述

HTML:

<div #map id="map" style="height:250px;"></div>

CSS:

#map{
  height: 100%;
  width: 100%;
  font-size: 15px;
}

.gm-style-mtc > div:first-child {
  width: 60px;
  height: 20px;
  font-size: 15px;
}

.gm-style-mtc > div > div {
  width: 100%;
  height: 100%;
  font-size: 15px;
}

标签: htmlcssgoogle-maps

解决方案


您是否尝试过添加!important属性?

!importantproperty 忽略其他 CSS 规则,并应用那些具有!important属性的规则。例如:

.gm-style-mtc > div:first-child {
  width: 60px;
  height: 20px;
  font-size: 15px !important;
}

.gm-style-mtc > div > div {
  width: 100%;
  height: 100%;
  font-size: 15px !important;
}

我希望这有帮助!


推荐阅读