简体   繁体   English

背景图像在 Safari v14 Catalina 上不起作用

[英]Background image doesn't work on Safari v14 Catalina

I have my project almost done, but faced the issue that background image doesn't work on MacOS Catalina Safari version 14. Do you happen to know where the problem can be?我的项目快完成了,但遇到了背景图像在 MacOS Catalina Safari 版本 14 上不起作用的问题。你知道问题出在哪里吗? Thank you in advance, ohh.先谢谢了,呵呵。 I also should mention that project is written on React with TS.我还应该提到该项目是在 React with TS 上编写的。

.image {
  width: calc(100vw - 48rem);
  height: 100vh;
  background: url('../../public/img/auth-bg.jpg') left center no-repeat;
  -o-background-size: cover;
  -moz-background-size: cover;
  -ms-background-size: cover;
  -webkit-background-size: cover;
  background-size: cover;
  @include mobile() {
    width: 0;
  }
}

try This, public URL is base Url in the project you can it like this试试这个,公共 URL 是项目中的基础 Url 你可以这样

.image {
  width: calc(100vw - 48rem);
  height: 100vh;
  background: url('/img/auth-bg.jpg') left center no-repeat;
  -o-background-size: cover;
  -moz-background-size: cover;
  -ms-background-size: cover;
  -webkit-background-size: cover;
  background-size: cover;
  @include mobile() {
    width: 0;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM