css - css 模糊了 chrome 中的框边框

标签 css google-chrome

enter image description here

body {
  font-family: sans-serif;
}
p {
  column-fill: balance;
  column-count: 2;
}

.box {
  width: 100px;
  height: 100px;
  background-color: red;
  filter: blur(5px);
  z-index: -1;
  animation: move 15s linear infinite;
}
.box2 {
  position: relative;
  width: 100vw;
  height: 100vh;
}
.box2::before {
  content: " ";
  position: absolute;
  top: -0px;
  left: -0px;
  bottom: -0px;
  right: -0px;
  background-image: conic-gradient(
    from 36deg at 20% 80%,
    #a100ffff 0% 25%,
    #000000 25% 30%,
    #119cfdff 30% 50%
  );

  filter: blur(500px);
  z-index: -1;
  animation: move 15s linear infinite;
}
@keyframes move {
  from {
    transform: rotate(180deg);
  }

  to {
    transform: rotate(540deg);
  }
}
<!DOCTYPE html>
<html>
  <head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <div id="app"></div>
    <script src="src/index.js"></script>
    <link rel="stylesheet" type="text/css" href="src/styles.css" />
    <div>
      <div class="box">1<br />12</div>
      <div class="box2">1<br />12</div>
    </div>
  </body>
</html>

它看起来应该像最左边的 Firefox,但最近,它显示了奇怪的线框。是的,不久前情况并非如此。

我把代码codesandbox放在复制效果

https://codesandbox.io/

它看起来应该像最左边的 Firefox

最佳答案

您可以通过使用 3d 变换强制激活硬件加速来消除视觉伪影:

transform: rotate3D(0, 0, 1, 180deg);

不确定为什么它会在 Chrome 上发生,一定是最近引入的错误。

body {
  font-family: sans-serif;
}
p {
  column-fill: balance;
  column-count: 2;
}

.box {
  width: 100px;
  height: 100px;
  background-color: red;
  filter: blur(5px);
  z-index: -1;
  animation: move 15s linear infinite;
}
.box2 {
  position: relative;
  width: 100vw;
  height: 100vh;
}
.box2::before {
  content: " ";
  position: absolute;
  top: -0px;
  left: -0px;
  bottom: -0px;
  right: -0px;
  background-image: conic-gradient(
    from 36deg at 20% 80%,
    #a100ffff 0% 25%,
    #000000 25.5% 30%,
    #119cfdff 30.5% 50%
  );

  filter: blur(500px);
  background-color: white;
  z-index: -1;
  animation: move 15s linear infinite;
}
@keyframes move {
  from {
    transform: rotate3D(0, 0, 1, 180deg);
  }

  to {
    transform: rotate3D(0, 0, 1, 540deg);
  }
}
<!DOCTYPE html>
<html>
  <head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <div id="app"></div>
    <script src="src/index.js"></script>
    <link rel="stylesheet" type="text/css" href="src/styles.css" />
    <div>
      <div class="box">1<br />12</div>
      <div class="box2">1<br />12</div>
    </div>
  </body>
</html>

关于css - css 模糊了 chrome 中的框边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77471538/

相关文章:

jquery - 为什么 div 上的框阴影在 jQuery 动画期间消失?

javascript - Bootstrap 3 将元素对齐成圆形

css - 如何根据兄弟元素的高度设置固定高度

html - CSS 格式在 IE 中显示,但在 Chrome 或 Firefox 中不显示

css - 关键包装问题

HTML 元素高度相同,但一个在视觉上比另一个大

javascript - 为什么 Chrome 会在内存中保留匿名 MediaRecorder 对象?

javascript setInterval() 在 Dreamweaver 中有效,但在 Chrome 中无效

javascript - 在特定执行上下文 (iframe) 上运行 javascript

google-chrome - Chrome 中损坏的 ssl