【问题标题】:Image not Showing in fullscreen, Css图像未全屏显示,Css
【发布时间】:2021-06-26 20:31:55
【问题描述】:

我尝试了几种解决方案,但都没有奏效,图像不想以我指定的相同大小全屏显示是否可以在 css 中找到解决方案? 这是我的代码:

body {
    margin: 0;
    padding: 0;
    background:url(cactus2.jpg) no-repeat black;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

#nocursor {
    cursor: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: fixed;
}

【问题讨论】:

  • 无法用您提供的代码重现问题。作为旁注,不需要背景大小的前缀。默认情况下每个浏览器都支持它。
  • 能否请您向我们展示您的 HTML 代码?
  • @GucciBananaKing99 对于 body 上的背景图像,HTML 是无关紧要的,除非他将内联样式应用于 body 标签覆盖他的 CSS。
  • @GucciBananaKing99 我的 html 代码与图像无关,没有什么关系
  • 还有更贴切的答案吗?

标签: html css image background


【解决方案1】:

body {
  margin: 0;
  padding: 0;
  background: url(http://via.placeholder.com/100x50.jpg) no-repeat black;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

#nocursor {
  cursor: none;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  position: fixed;
  object-fit: center;
}

【讨论】:

  • 不工作,但如果有一段我的 html 代码可能是相关的(我使用 ruffle 使 swf 工作)
  • 另外,如果可能有帮助,我正在使用 document.requestfullscreen
猜你喜欢
  • 2013-02-14
  • 1970-01-01
  • 2021-12-15
  • 2018-12-31
  • 2016-03-17
  • 2010-12-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多