倾斜变换后去除边框一侧的背景轮廓
HTML:
<div class="labels">
<p>Very Funny</p>
</div>
CSS:
div.labels p {
background: red;
border-left: 2rem solid white;
border-right: 2rem solid white;
color: white;
font-family: 'Bebas Neue';
text-transform: uppercase;
line-height: 0.8;
transition: 0.4s ease all;
font-size: 4rem;
-webkit-text-stroke: 2px white;
letter-spacing: 2px;
width: fit-content;
padding: 1rem 2rem;
transform: skew(-10deg);
}
这是演示: https://jsfiddle.net/90vLp4ub/
您会注意到由于背景原因,元素周围有一条细红线。我怎样才能摆脱它?
谢谢。
HTML:
<div class="labels">
<p>Very Funny</p>
</div>
CSS:
div.labels p {
background: red;
border-left: 2rem solid white;
border-right: 2rem solid white;
color: white;
font-family: 'Bebas Neue';
text-transform: uppercase;
line-height: 0.8;
transition: 0.4s ease all;
font-size: 4rem;
-webkit-text-stroke: 2px white;
letter-spacing: 2px;
width: fit-content;
padding: 1rem 2rem;
transform: skew(-10deg);
}
Here is the demo: https://jsfiddle.net/90vLp4ub/
You will notice that there is a thin red line around the element due to the background. How can I get rid of that?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要删除红色轮廓并保留动画,您可以执行以下操作:
To remove the red outlines and keep the animation, you can do this:
只需将左右边距删除为实心即可。他们对那些红色轮廓负责
Just remove that left and right margins as solid. They are responsible for those red outlines