Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个背景大小为 25% 的 div……我有一些 JavaScript 可以做一个下拉框。没有 div,过渡是平滑的,但是有 div 存在,下拉框非常不稳定。当背景大小设置为 25% 时,它唯一的波动......有没有办法解决它,所以它不会滞后?
您可以使用图像编辑器提前缩小图像并摆脱background-size规则。
background-size
当您使用 CSS(或 HTML 属性)调整图像大小时,首先下载完整大小的图像,然后在显示之前在内存中调整大小。如果您改为提供较小的图像(通过调整服务器上的图像大小),它将更快地下载。