简体   繁体   English

背景图像在 Chrome 中消失

[英]background-image disappearing in Chrome

In a website I am developing, the background image is disappearing in Chrome.在我正在开发的网站中,背景图像在 Chrome 中消失了。 It is working fine in Edge and Firefox. I tried it in Another laptop to assure the problem is with Chrome and same in other laptop too.它在 Edge 和 Firefox 中运行良好。我在另一台笔记本电脑上尝试过,以确保问题出在 Chrome 上,在其他笔记本电脑上也一样。 On inspecting, I found that for some unknown reason, Chrome automatically adds a property background-image: none;在检查时,我发现出于某种未知原因,Chrome 自动添加了一个属性background-image: none; directly to the element.直接到元素。 See the faulty code here在这里查看错误代码

This overwrites the property and div and makes background none.这会覆盖属性和 div 并使背景变为无。 On disabling this property in inspect tool, the background images appears but refreshing page brings back the problem.在检查工具中禁用此属性时,会出现背景图像,但刷新页面会再次出现该问题。

Well, here i have suggestions for you:好吧,在这里我有一些建议给你:

  1. Check if any adblocker is working in your chrome or not.检查是否有广告拦截器在您的 chrome 中运行。 If yes, then please remove it, and try again.如果是,请将其删除,然后重试。
  2. Do not run the code at Chrome's incognito不要在 Chrome 的隐身模式下运行代码
  3. Add the style elements at the head section of your HTML file.在 HTML 文件的头部添加样式元素。

Please let me know if it works or not.请让我知道它是否有效。 Don't hesitate to ask further questions.不要犹豫,提出更多问题。

I have found the root cause.我找到了根本原因。 It was due to an extension.这是由于延期。 It was not the Ad-Blocker in my case.就我而言,这不是广告拦截器。 Removing that extension has solved my problem删除该扩展程序解决了我的问题

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

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