【发布时间】:2016-06-10 19:13:46
【问题描述】:
我有一个带有一种边框颜色的圆圈的 CSS:
m = new MarkerWithLabel({
position: pos,
map: map,
labelContent: txt,
labelAnchor: new google.maps.Point(18, 18),
labelClass: "circle",
icon: "/i/t.png"
});
.circle {
border: 6px solid #ffd511;
border-radius: 30px;
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
-khtml-border-radius: 30px;
width: 30px;
height: 18px;
line-height: 20px;
padding: 12px 6px;
text-align: center;
}
<div class="circle">17</div>
看起来像这样:
我应该如何将 CSS 更改为具有三种边框颜色 - 就像时钟一样:
- 从0到4色#1
- 从4到8色#2
- 从8到12色#3
就像我上一个问题的answer 一样:
svg{width:30%;height:auto;}
<svg viewbox="0 0 10 10">
<defs>
<circle id="circle" cx="5" cy="5" r="4" stroke-width="0.5" fill="transparent" />
</defs>
<use xlink:href="#circle" stroke="pink" stroke-dasharray="0,2.09,8.38,30" />
<use xlink:href="#circle" stroke="green" stroke-dasharray="0,10.47,8.38,30" />
<use xlink:href="#circle" stroke="orange" stroke-dasharray="2.09,16.75,6.3" />
</svg>
必填
圆圈元素是 Google Maps API v3 中显示的标记,因此我无法使用 SVG。
另一种解决方案是使用图像:
.circle {
background: url('circle.png') no-repeat;
width: 58px;
height: 58px;
line-height: 20px;
text-align: center;
}
【问题讨论】:
-
给它一个GO
标签: javascript css google-maps-markers