如何在HTML/CSS中沿SVG的对角线添加阴影效果?
我在html中定义了一个SVG:
<svg style="height: 28px; background-color: 'blue'; " viewBox="0 0 436 217"
preserveAspectRatio="none" class="Tagline-triangle" fill="#EAEAEA" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H436V217L0 0Z"></path>
</svg>
我想沿蓝色和红色相遇的对角线添加阴影效果。我该怎么做?
I have a SVG defined in HTML like this:
<svg style="height: 28px; background-color: 'blue'; " viewBox="0 0 436 217"
preserveAspectRatio="none" class="Tagline-triangle" fill="#EAEAEA" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H436V217L0 0Z"></path>
</svg>
which ends up looking like this:
I want to add a shadow effect along the diagonal where the blue and red meet. How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在三角形SVG路径上使用
过滤器:drop-shadow()
。仅在IE11和Opera Mini中不支持它。如果需要,您可以在路径上内联插头。
You can use
filter: drop-shadow()
on the triangle svg path. It's only not supported in IE11 and opera mini.You can do the drop shadow filter style inline on the path if you want.