简体   繁体   中英

Background url in external css not loading on chrome

Please I have been having a problem with background image url referenced in my external css. I have gone through all the answers to similar questions asked but none is working. I am trying to put a background imagine to an archor tag with a class name tw. It is not the problem of the path because i tried it in my html in img tag and it worked perfectly...If i put the same path in the url in my css file, the browser shows me an error of file not found. i don't know what the problem is. Here is the code,

```
a.tw{ 
      background: url(images\tw.png)
  } no-repeat center;

```

I would specify the exact attribute, which is background-image (see https://www.w3schools.com/cssref/pr_background-image.asp ) and use quotes as well:

a.tw{ 
      background-image: url("images/tw.png");
}

If you want to use custom background , then you can try:

a.tw{ 
      background: url("images/tw.png") no-repeat center;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM