背景图片不起作用

时间:2018-04-13 12:27:15

标签: css3

这是页面的hmtl,我没有看到错误和img在notepad ++中没有显示的地方。比你回答我

  <!DOCTYPE html>
    <html>
    <head>
    <title>Page Title</title>
    <link rel="stylesheet" type="text/css" href="theme.css">
    </head>
    <body>
    </body>
    </html>
   /* this line doesn't show the img*/
    body {
       background-image: url("‪C:\Users\zineelabidine\Desktop\fayss.jpg");
       }

2 个答案:

答案 0 :(得分:0)

对于img标记,您不使用固定路径,如C:\ Users \ zineelabidine \ Desktop \ fayss.jpg。使用像url('fayss.jpg')这样的相对路径。 (该路径假设图像和html文件位于同一文件夹中)

答案 1 :(得分:0)

将您的Image和html文件保存在同一文件夹中并使用此代码,希望它可以帮助您:

body {
   background-image: url("fayss.jpg");
   }