You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

解决图片角落边框加载后出现细缝的问题

问题:角落边框出现细缝

尝试给图片添加左上角与右下角的角落边框,完成后发现页面加载数秒后,角落边框处出现一道细缝(已加宽边框以便清晰展示)。

角落边框的细缝

实现代码

HTML代码

<div class="picture">
    <img src="picture/MyPhoto.jpg" alt="My profile picture">
</div>

CSS代码

.picture {
    height: auto; 
    width: 35%; 
    position: relative;
    top: 200px;
    left: 55%;
    transform: translate(-30%, -30%);   
    animation: fadeIn 3s;    
}

.picture img {
    max-width: 50%;
    max-height: 50%;
    float: right;  
}

.picture::before,
.picture::after {
    content: '';
    position: absolute;
    z-index: -1;
    background-clip: padding-box; 
    box-sizing: border-box; 
}

.picture::before {
    top: -40px;
    left: 200px;
    border-width: 10px;
    border-style: solid;
    height: 150px;
    width: 150px;
    border-image: linear-gradient(to bottom right, #000AFF, #DB00FF 50%, transparent 50%) 1; 
}
.picture::after {
    bottom: -550px;
    right: -130px;
    border-width: 10px;
    border-style: solid;
    height: 150px;
    width: 150px;
    border-image: linear-gradient(to top left,  #000AFF, #DB00FF 50%, transparent 50%) 1;
}

已尝试调整渐变颜色、宽高等参数,但细缝问题仍未解决。


内容的提问来源于stack exchange,提问作者Vintoo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 12:52:09