简体   繁体   English

尽管使用本地或外部链接,我的背景图像仍无法加载

[英]My background image failed to load despite using local or external link

Here's html file: 这是html文件:

<section>
    <div id="section1" class="container">
    </div>
</section>

Here's the css: 这是CSS:

#section1{
    height: auto;
    margin-top: 0px;
    background-image: url('bg-1.jpg');
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
}

I tried to replace the url with an external link (from google) but it still failed to load 我试图用外部链接(来自Google)替换网址,但仍然无法加载

Use your browser's Developer Tools to inspect and understand what might be happening. 使用浏览器的开发人员工具检查并了解可能发生的情况。 Maybe the element is being drawn with zero hight, for example, or maybe the network connection failed. 例如,也许元素的绘制高度为零,或者网络连接失败。 In Chrome, right click on the page and click Inspect Element and then navigate around various tabs (such as Elements , Network , Console , etc.), refresh the page, and keep looking at the information that the Developer Tools panel gives you. 在Chrome中,右键单击页面,然后单击Inspect Element ,然后在各个选项卡(例如ElementsNetworkConsole等)中导航,刷新页面,并继续查看Developer Tools面板为您提供的信息。 This will be the easiest and most reliable way to understand how your page is being rendered, how resources are being downloaded, and what the issues may be. 这将是了解页面呈现方式,资源下载方式以及问题可能的最简单,最可靠的方法。

Other browsers (Safari, Edge, Firefox) also have similar Developer Tools panels that you can turn on and inspect your page. 其他浏览器(Safari,Edge,Firefox)也具有类似的“ 开发人员工具”面板,您可以打开并检查页面。 I'm most familiar with Chrome's tools and find them extremely useful for debugging my webpages. 我最熟悉Chrome的工具,并且发现它们对于调试网页非常有用。

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

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