当一个人在圆圈上悬停时,我希望它是120%。我尝试了宽度,高度和笔触。还没有找到任何解决方案,让圆圈在悬停时变大。有什么建议吗?circle:h">
所以我有我的SVG-circle。
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="168" cy="179" r="59" fill="white" />
</svg>
当一个人在圆圈上悬停时,我希望它是120%。我尝试了宽度,高度和笔触。还没有找到任何解决方案,让圆圈在悬停时变大。有什么建议吗?
circle:hover
{
stroke-width:10px;
}
circle:hover
{
height: 120%;
width: 120%;
}
发布于 2013-01-10 12:36:03
根据SVG1.1规范,您不能使用CSS https://www.w3.org/TR/SVG/styling.html#SVGStylingProperties设置SVG圆的r
属性的样式。但是你可以这样做:
<circle cx="168" cy="179" r="59"
fill="white" stroke="black"
onmouseover="evt.target.setAttribute('r', '72');"
onmouseout="evt.target.setAttribute('r', '59');"/>
在某些现代浏览器部分支持的SVG2中,可以使用CSS设置圆的r
属性的样式。https://www.w3.org/TR/SVG2/styling.html#PresentationAttributes
发布于 2013-07-03 23:46:31
想只使用CSS吗?使用line
而不是circle
。
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<style>
.circle {
stroke-width: 59;
stroke-linecap: round;
}
.circle:hover {
stroke-width: 71;
}
</style>
<line x1="168" y1="179" x2="168" y2="179" stroke="white" class="circle" />
</svg>
发布于 2014-10-31 14:51:20
这可以在CSS(3)中完成,方法是将圆的transform-
原点设置为圆心,然后使用scale
变换:
circle {
transform-origin: center center;
}
circle:hover {
stroke-width: 10px;
transform:scale(1.2, 1.2);
}
https://stackoverflow.com/questions/14255631
复制相似问题