【发布时间】:2021-12-24 04:58:53
【问题描述】:
我可以使用原生 SVG 语法或在 CSS 中做些什么来修复这个剪裁的边缘不会出现在我的 SVG 中?
body {
margin: 0;
background: #fff;
text-align: center;
}
#profile-pic {
width: 33%;
}
#profile-pic text {
font-size: 48px;
font-family: monospace;
font-weight: bold;
fill: #000;
-webkit-animation: raise 1s linear infinite alternate;
animation: raise 1s linear infinite alternate;
}
@-webkit-keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
@keyframes raise {
from { transform: translateY(-10px); }
to { transform: translateY(10px); }
}
<svg id="profile-pic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 500">
<title>Brandon McConnell</title>
<defs>
<clipPath id="imageClipPath"><circle cx="250" cy="250" r="116" fill="#FFFFFF" /></clipPath>
</defs>
<text dy="70" textLength="500">Lorem Ipsum</text>
<image
href="https://s.gravatar.com/avatar/6e25e38e140dda7ac64f7865b3df77ab?s=500"
clip-path="url(#imageClipPath)"
width="240"
height="240"
x="130"
y="130"
/>
</svg>
我在最新版本的 Chrome 中看到了这一点。截图:
系统规格
MacBook Pro (Retina, 15-inch, Late 2013)
macOS Big Sure - Version 11.6.1 (20G224)
Google Chrome - Version 95.0.4638.69 (Official Build) (x86_64)
【问题讨论】:
-
在我的 WIndows10 笔记本电脑上,我在 Chrome/Edge 或 Firefox 上看不到该边框。您是否在不同的缩放级别看到它?
-
是的,我测试并在 50%、100% 和 150%(和其他)缩放时看到它
-
你使用的是什么操作系统?
-
@AHaworth 更新了我的问题以包括我的系统规格。谢谢。
-
谢谢。现在随着 Lorem Ipsum 的上下弹跳,我看到了这些线条(WIndows10 Chrome/Edge)。