【问题标题】:make an image the background and take up the entire web page将图像作为背景并占据整个网页
【发布时间】:2018-06-04 12:17:20
【问题描述】:

所以我正在开发一个网站,我想添加一张图片作为背景并让它占据整个网页,所以如果滚动图片仍然可用,但我不知道该怎么做这。

【问题讨论】:

  • here
  • 尚不清楚 C# 与此有什么关系。

标签: css image


【解决方案1】:

将以下 CSS 添加到您的项目中:

body {
   background-image: url("myImage.png");
   background-attachment: fixed;
   background-repeat: no-repeat;
}

【讨论】:

  • 我还建议使用background-attachment: fixed; background-repeat: no-repeat; 以修复可能未平铺的图像。
  • @Forty3 更新答案以反映您的评论。
猜你喜欢
  • 2021-12-28
  • 1970-01-01
  • 2021-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-04
相关资源
最近更新 更多