未在html中显示背景图像
我有以下css未在html中显示背景图像,html,css,user-interface,web,Html,Css,User Interface,Web,我有以下css <!DOCTYPE html > <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro Summer Menu</title> <link href='http://fonts.googleapis.com/css?family=Marko+One' rel='stylesheet' type='text/css'> <
<!DOCTYPE html >
<html>
<head>
<meta charset="utf-8">
<title>Black Goose Bistro Summer Menu</title>
<link href='http://fonts.googleapis.com/css?family=Marko+One' rel='stylesheet' type='text/css'>
<style>
body {
font-family: Georgia, serif;
font-size: 100%;
line-height: 175%;
margin: 0 15% 0;
background-image:url(images/bullseye.png);
}
#header {
margin-top: 0;
padding: 3em 1em 2em 1em;
text-align: center;
}
a {
text-decoration: none;
}
h1 {
font: bold 1.5em Georgia, serif;
text-shadow: .1em .1em .2em gray;
}
h2 {
font-size: 1em;
text-transform: uppercase;
letter-spacing: .5em;
text-align: center;
}
dt {
font-weight: bold;
}
strong {
font-style: italic;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
#info p {
font-style: italic;
}
.price {
font-family: Georgia, serif;
font-style: italic;
}
p.warning, sup {
font-size: small;
}
.label {
font-weight: bold;
font-variant: small-caps;
font-style: normal;
}
h2 + p {
text-align: center;
font-style: italic;
}
);
</style>
</head>
<body>
<div id="header">
<h1>Black Goose Bistro • Summer Menu</h1>
<div id="info">
<p>Baker's Corner, Seekonk, Massachusetts<br>
<span class="label">Hours: Monday through Thursday:</span> 11 to 9, <span class="label">Friday and Saturday;</span> 11 to midnight</p>
<ul>
<li><a href="#appetizers">Appetizers</a></li>
<li><a href="#entrees">Main Courses</a></li>
<li><a href="#toast">Traditional Toasts</a></li>
<li><a href="#dessert">Dessert Selection</a></li>
</ul>
</div>
</div>
<div id="appetizers">
<h2>Appetizers</h2>
<p>This season, we explore the spicy flavors of the southwest in our appetizer collection.</p>
<dl>
<dt>Black bean purses</dt>
<dd>Spicy black bean and a blend of mexican cheeses wrapped in sheets of phyllo and baked until golden. <span class="price">$3.95</span></dd>
<dt class="newitem">Southwestern napoleons with lump crab — <strong>new item!</strong></dt>
<dd>Layers of light lump crab meat, bean and corn salsa, and our handmade flour tortillas. <span class="price">$7.95</span></dd>
</dl>
</div>
<div id="entrees">
<h2>Main courses</h2>
<p>Big, bold flavors are the name of the game this summer. Allow us to assist you with finding the perfect wine.</p>
<dl>
<dt class="newitem">Jerk rotisserie chicken with fried plantains — <strong>new item!</strong></dt>
<dd>Tender chicken slow-roasted on the rotisserie, flavored with spicy and fragrant jerk sauce and served with fried plantains and fresh mango. <strong>Very spicy.</strong> <span class="price">$12.95</span></dd>
<dt>Shrimp sate kebabs with peanut sauce</dt>
<dd>Skewers of shrimp marinated in lemongrass, garlic, and fish sauce then grilled to perfection. Served with spicy peanut sauce and jasmine rice. <span class="price">$12.95</span></dd>
<dt>Grilled skirt steak with mushroom fricasee</dt>
<dd>Flavorful skirt steak marinated in asian flavors grilled as you like it<sup>*</sup>. Served over a blend of sauteed wild mushrooms with a side of blue cheese mashed potatoes. <span class="price">$16.95</span></dd>
</dl>
</div>
<div id="toast">
<h2>Traditional Toasts</h2>
<p>The ultimate comfort food, our traditional toast recipes are adapted from <a href="http://www.gutenberg.org/files/13923/13923-h/13923-h.htm"><cite>The Whitehouse Cookbook</cite></a> published in 1887.</p>
<dl>
<dt>Cream toast</dt>
<dd>Simple cream sauce over highest quality toasted bread, baked daily. <span class="price">$3.95</span></dd>
<dt>Mushroom toast</dt>
<dd>Layers of light lump crab meat, bean and corn salsa, and our handmade flour tortillas. <span class="price">$6.95</span></dd>
<dt>Nun's toast</dt>
<dd>Onions and hard-boiled eggs in a cream sauce over buttered hot toast. <span class="price">$6.95</span></dd>
<dt>Apple toast</dt>
<dd>Sweet, cinnamon stewed apples over delicious buttery grilled bread. <span class="price">$6.95</span></dd>
</dl>
</div>
<div id="dessert">
<h2>Dessert Selection</h2>
<p>Be sure to save room for our desserts, made daily by our own <a href="http://www.jwu.edu/college.aspx?id=19510">Johnson & Wales</a> trained pastry chef.</p>
<dl>
<dt class="newitem">Lemon chiffon cake — <strong>new item!</strong></dt>
<dd>Light and citrus flavored sponge cake with buttercream frosting as light as a cloud. <span class="price">$2.95</span></dd>
<dt class="newitem">Molten chocolate cake</dt>
<dd>Bubba's special dark chocolate cake with a warm, molten center. Served with or without a splash of almond liqueur. <span class="price">$3.95</span></dd>
</dl>
</div>
<p class="warning"><sup>*</sup> We are required to warn you that undercooked food is a health risk.</p>
</body>
</html>
这个html页面是bistro.html,它所在的目录中有一个文件夹images,在images文件夹中我有一个文件bullseye.png。我希望png会出现在背景中。但事实并非如此。为了回答问题,我也在这里发布了这张图片
让我知道css的语法是否错误?
以下是图片
这可能是路径问题,而且url中缺少
”
:
尝试使用以下url访问您的图像:
www.yoursite.com/images/bullseye.png
,查看url中的图像路径是否正确 图像是白色的,我看不出您没有指定背景色。您确定它没有正确加载,但不可见,因为它是白色对白色
编辑:尝试添加颜色,看看是否有帮助:
背景:黑色url(images/bullseye.png)代码>您只需要更改背景的颜色,因为图像的颜色是白色的,所以它不会显示在白色页面上。更改背景颜色#000、#333、#666、#999等
body{background:#333;}
请给我链接或链接。目前看起来像是路径问题。如果在页面本身中包含HTML
,是否会看到图像?如果您链接到CSS的已知良好图像,例如background image:url,会怎么样(http://placekitten.com/200/300);代码>?你确定你的图像文件名是大写的吗?链接中的图像即将出现bullseye.png图像不会出现,但如果我放置任何其他图像而不是bullseye.png,则会出现。无需使用任何引号,因为某些浏览器不支持引号。确定你建议的方法有效,我可以看到图像,因为背景是白色的,所以我无法看到图像
background-image:url('images/bullseye.png');
background-color: #000;
body{background:#333;}