简体   繁体   English

外部css中的背景网址未在chrome上加载

[英]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.请在我的外部 css 中引用背景图片 url 时遇到问题。 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.我试图将背景想象放到一个类名为 tw 的 archor 标签上。 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.这不是路径的问题,因为我在我的 html 中的 img 标记中尝试过它并且它运行良好......如果我在我的 css 文件中的 url 中放置相同的路径,浏览器会向我显示找不到文件的错误。 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:我会指定确切的属性,即background-image (请参阅https://www.w3schools.com/cssref/pr_background-image.asp )并使用引号:

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

If you want to use custom background , then you can try:如果你想使用自定义background ,那么你可以尝试:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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