无法显示背景图像

时间:2015-03-24 17:55:52

标签: html css

我将这张照片保存在与html文件相同的文件夹中,但仍然无法打开,任何人都可以帮助我吗?

<!DOCTYPE html>
<html>
    <head>
        <title>Computer Systems</title>
     </head>


 <body background=“F50 Gallery Black 005.jpg”>

 <h1>Computer System Designs</h1>


<h2>What are computer systems?</h2>
<p>Computer systems are a set of hardware devices like a monitor (screen),<br> a central processing unit (CPU), keyboard and mouse that are connected together and run software programs such as Microsoft word, antivirus, paint, google chrome etc </p>


<h2>How are they designed?</h2>
<p>Computer systems are designed by</p>
</body>



</html>

3 个答案:

答案 0 :(得分:1)

不再支持身体背景。请改用CSS

<body style="background-image:url('F50 Gallery Black 005.jpg')">

答案 1 :(得分:0)

我建议和Snehal Shah一样。

这是该主题的有用链接。 http://www.w3schools.com/css/css_image_sprites.asp

长话短说:

body {
background: url(005.jpg) 0 0;
}

ps:似乎你的头衔也已关闭。切勿在图像标题中使用空格

答案 2 :(得分:0)

@ JayG747在您的网站中使用CSS作为样式,请访问以下链接以获取示例,以防使用:

http://www.w3schools.com/css/

<!DOCTYPE html>
<html>
    <head>
        <title>Computer Systems</title>
     </head>
     <style type="text/css">
         body{
            background-image: url('F50_Gallery_Black_005.jpg'); <!-- Avoid special characters and blank spaces in filenames. -->
         }
     </style>

 <body>

 <h1>Computer System Designs</h1>


<h2>What are computer systems?</h2>
<p>Computer systems are a set of hardware devices like a monitor (screen),<br> a central processing unit (CPU), keyboard and mouse that are connected together and run software programs such as Microsoft word, antivirus, paint, google chrome etc </p>


<h2>How are they designed?</h2>
<p>Computer systems are designed by</p>
</body>



</html>

注意:最好在具有.css扩展名的单独文件中输入您网站的样式,并将其插入您的html文件中,如下所示:

<link rel="stylesheet" href="style.css" />