Home > Net >  Background url in external css not loading on chrome
Background url in external css not loading on chrome

Time:07-20

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;
   }

```

CodePudding user response:

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;
}
  • Related