背景图片未显示 CSS
Background image not showing CSS
我想在我的网站上有一个背景图片。出于某种原因,当我使用占位符时(background: url(http://via.placeholder.com/1920x500) no-repeat center top;)
,占位符没有问题出现,但是当我使用笔记本电脑上的图像时......它不显示。下面是我如何显示图像:
background: url("/images/about.jpeg") no-repeat center top;
我也试过:
background-image: url("/images/about.jpeg") no-repeat center top;
我得到了相同的结果。请协助新人CSS
文件结构如下:
如果您的样式表在 CSS
文件夹中,CSS 规则应该是这样的:
background: url("../images/about.jpeg") no-repeat center top;
即从 "css" 文件夹 出来 并 进入 "images" 文件夹
css 文件无法找到您的图片。
您必须将图像 url 更改为
url("../image_url")
我想在我的网站上有一个背景图片。出于某种原因,当我使用占位符时(background: url(http://via.placeholder.com/1920x500) no-repeat center top;)
,占位符没有问题出现,但是当我使用笔记本电脑上的图像时......它不显示。下面是我如何显示图像:
background: url("/images/about.jpeg") no-repeat center top;
我也试过:
background-image: url("/images/about.jpeg") no-repeat center top;
我得到了相同的结果。请协助新人CSS
文件结构如下:
如果您的样式表在 CSS
文件夹中,CSS 规则应该是这样的:
background: url("../images/about.jpeg") no-repeat center top;
即从 "css" 文件夹 出来 并 进入 "images" 文件夹
css 文件无法找到您的图片。
您必须将图像 url 更改为
url("../image_url")