g {
fill: #fdd;
transition: 500ms;
}
g:hover {
fill: wheat;
}
text {
pointer-events: none;
}
.pol{
clip-path: polygon(270px 60px, 250px 80px, 285px 95px);
}
<svg>
<defs>
<filter id="shadow" x=-50% y=-50% width=200% height=200%>
<feDropShadow dx="5" dy="5" stdDeviation="5"
flood-color="#333" flood-opacity=".1" />
</filter>
</defs>
<g>
<rect filter="url(#shadow)"
x="10" y="10" width="270" height="70" rx="25" />
<polygon points="270 60 250 80 285 95" />
</g>
<text x="140" y="50" text-anchor="middle">example text</text>
</svg>
<svg>
<defs>
<filter id="shadow" x=-50% y=-50% width=200% height=200%>
<feDropShadow dx="5" dy="5" stdDeviation="5"
flood-color="#333" flood-opacity=".1" />
</filter>
</defs>
<g>
<rect filter="url(#shadow)"
x="10" y="10" width="270" height="70" rx="25" />
<polygon class="pol" />
</g>
<text x="140" y="50" text-anchor="middle">Пример с clip-path</text>
</svg>
我通过将这一行更改为这一行<polygon points="270 60 250 80 285 95" />来完成样式<polygon class="pol" />,但它不起作用
要更改工具提示的轮廓,您可以尝试使用属性动画
dpath动画基于从
path没有箭头的初始椭圆到有箭头的最终椭圆的平滑过渡path。当您将鼠标悬停在工具提示上时,工具提示的颜色会发生变化,并且当您单击它时会出现一个箭头。
再次单击时,箭头会平滑消失。
您可以尝试使用更有趣的工具提示形式
CSS 变体。答案并不完全在主题上,但也许对某人有用。
作为奖励,加上一个小鼻子动态=)