我已经仔细检查了我的 URL 和文件名,但我似乎无法显示图像。为什么会这样?这是我的代码(注意 <p>
在 body 标签内,我没有添加完整代码,我只添加了头部和具体问题)。
<html>
<head>
<title>Head First Lounge.</title>
<link type="text/css"
rel="stylesheet"
href="stylesheet/style.css"
media="screen"/>
</head>
<p class = "guarantee">
Our guarantee: at the lounge, we're committed to providing you,
our guest, with an exceptional experience every time you visit.
Whether you're just stopping by to check in on email over an
elixir, or are here for an out-of-the-ordinary dinner, you'll
find our knowledgeable service staff pay attention to every detail.
If you're not fully satisfied, have a Blueberry Bliss Elixir on us.
</p>
这是那部分的 CSS 规则
.guarantee{
background-image: url(images/background.gif);
font-family: "Geogia", "Times New Roman", Times, serif;
border-color: black;
border-width: 1px;
border-style: solid;
background-color: #a7cece;
padding: 25px;
margin: 30px;
line-height: 1.9em;
font-style: italic;
color: #444;
}
原文由 user962206 发布,翻译遵循 CC BY-SA 4.0 许可协议
试试这个:
没有
../
它正在寻找样式表文件夹中不存在的图像文件夹。所以你必须回到图像文件夹所在的目录。编辑:你也可以像这样缩短你的 CSS 样式: