css3-translate3d-模糊bug - css3怎么解决1px的边框模糊

 幸福蜗牛yeshi牛 发布于 2022-11-05 19:55

我这个关闭按钮的边框和那个叉叉都会有模糊要怎么解决

.popmidbox{ width:300px; height: 200px;border: 1px solid #ccc;margin: 100px auto;position: relative; } .icon_close{ width: 16px;height: 16px;border-radius: 50%;border:1px solid #CCC;background: #fff; padding: 5px;position:absolute;top: -12px;right: -12px;z-index: 2; } .icon_close::before{ content:"";transform: rotate(-45deg);-webkit-transform: rotate(-45deg); width: 1px;height: 17px;background: #ccc;overflow: hidden;position: absolute; top:5px;left: 13px; } .icon_close::after{ content:"";transform: rotate(45deg);-webkit-transform: rotate(45deg); width: 1px;height: 17px;background: #ccc;overflow: hidden;position: absolute; top:5px;right: 13px; }
3 个回答
  • transform: translateZ(0);

    有些性能不是很高的设备,或者性能分配资源太少会这样。
    强制用3D触发硬件渲染,可能会解决。

    2022-11-10 04:39 回答
  • 可以试试将.icon_close里的所有元素设置为双倍大小,然后对.icon_closetranform: scale(0.5)缩小一半。

    2022-11-10 04:40 回答
  • 你这个看起来好 高端(而且也好复杂的样子)。
    现在用SVG画的边框,感觉比较容易。

      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'><line x1='100%' y1='0%' x2='100%' y2='100%' style='stroke:#e5e5e5;stroke-width:1'/><line x1='0%' y1='100%' x2='100%' y2='100%' style='stroke:#e5e5e5;stroke-width:1' /></svg>");
      background-repeat: no-repeat;
      background-position: 0 100%;
    

    右边框和下边框

    http://codepen.io/charleyw/pen/qbqgQR

    2022-11-10 04:51 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有