use*_*206 8 html css html5 web
我已经仔细检查了我的URL和文件的名称,但我似乎无法显示图像.为什么会那样?这是我的代码(记下<p>身体标签内部,我没有添加完整代码,我只添加了头部和具体问题).
<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>
Run Code Online (Sandbox Code Playgroud)
这是该部分的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;
}
Run Code Online (Sandbox Code Playgroud)
Dre*_*rew 33
试试这个:
background-image: url(../images/background.gif);
Run Code Online (Sandbox Code Playgroud)
如果没有,../它会在样式表文件夹中查找不存在的图像文件夹.因此,您必须返回images文件夹所在的目录.
编辑:您还可以缩短CSS样式,如下所示:
.guarantee{
background: #a7cece url(../images/background.gif);
border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)