search

Home  >  Q&A  >  body text

Why doesn’t the background I set appear?

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Title</title>
</head>
<body >
<div style="background-image: url('C:\Program Files\JetBrains\PhpStorm 2017.3\mn.jpg')">你好</div>
</body>
</html>

残刀殉菊残刀殉菊2336 days ago1210

reply all(2)I'll reply

  • 漫步

    漫步2018-08-21 09:25:51

    I am also a beginner, and I have two understandings about this problem

    The first one: the picture path, you need to make sure that the picture path is indeed correct, and generally we use relative paths instead Non-absolute path

    Second: Your div does not define width and height, so I personally think it is normal that the background is not displayed

    reply
    0
  • 残刀殉菊

    Thank you, I found the reason, it's a browser problem

    残刀殉菊 · 2018-08-21 10:08:09
  • 秋香姐家的小书童

    秋香姐家的小书童2018-08-15 09:36:10

    Picture background Did you put the C drive?

    The only reason why the background does not appear is that the path is incorrect. Check the path.

    reply
    0
  • Cancelreply