CSS / SCSS的不同渲染行为

雷内

我已经尝试将这个示例与一些跳跃点集成在一起,以作为延迟加载其他脚本和图像的后备方法。

但是,如果我更改css,如下面的示例所示,在我的示例中,最后一个点看起来比其他两个点小(宽度更小?)。通过在我的codepen示例中使用相同的输入scss值,这些点将按预期方式显示:

此渲染: Codepen渲染:这个渲染 在此处输入图片说明

我还检查了计算出的样式,我只能看到span元素的计算出的高度和宽度值有所不同。

为什么在此代码示例中在stackoverflow上(以及在我的localhost node.js示例中)看到的渲染与在Codepen上的示例相比却有所不同?

我是否必须查看codepen示例中的所有父DOM元素才能获得缺少的CSS部分?

class App extends React.Component {
	constructor(props) {
		super(props);

		this.state = {};
    
    }

    render() {
        return (
            <div id="wave">
                <span className="dot">
                </span>
                <span className="dot">
                </span>
                <span className="dot">
                </span>
            </div>
        );
    }
}

ReactDOM.render(
  <App />,
  document.getElementById('container')
);
html, body {
   margin:0;
   padding:0;
}

body {
   background:#F6F7F8;
}

div#wave {
   position: relative;
   margin-top: 5vh;
   text-align: center;
   width: 100px;
   height: 100px;
   margin-left: auto;
   margin-right: auto;
}

div#wave .dot {
   display: inline-block;
   width: 6px;
   height: 6px;
   border-radius: 50%;
   margin-right: 6px;
   background: #303131;
   animation: wave 1.3s linear infinite;
}

div#wave .dot:nth-child(2) {
   animation-delay: -1.1s;
}

div#wave .dot:nth-child(3) {
   animation-delay: -0.9s;
}

@keyframes wave {
   0%, 60%, 100% {
      transform: initial;
   }

   30% {
      transform: translateY(-15px);
   }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.0.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.0.0/umd/react-dom.production.min.js"></script>

<div id='container'></div>

我正在使用chrome浏览器(版本83.0.4103.97),如果有任何不同的话。

凯文TD

我计算了您的圆圈的像素,所有像素均为7px,最后一个像素为6px宽(理论上,根据您的CSS唯一的权利):

像素数

在Windows10上放大显示器(大于或小于100%)时,这对我来说似乎是这样:https : //www.windowscentral.com/how-set-custom-display-scaling-setting-windows-10在Windows10上更改比例

这也给网站带来了很多pixelart错误!我将屏幕的比例更改为120%,中间的圆圈变粗了,但是如果我回到100%,它将恢复正常。

我已经完成了一些pixelart项目,并且收到了一些用户的投诉,并且无法重现该错误,然后有一天,我搞砸了该Windows函数并注意到了错误,这是Windows屏幕的缩放比例,通过“自定义比例”使某些像素失真。

从理论上讲,它将始终给出该函数的错误,除非它是100%的倍数,例如200%或300%,因为从理论上讲,像素的大小不会因该值而失真。

我不知道有没有解决方案,我从未发现过,因为这是Windows无法尝试调整“不存在”像素的失败

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章