本html脚本中的背景图片。https:/imgshare.ioimages20200608clothing_boutique.jpg。 不加载。
但是如果我们在同一个浏览器中先在任何新的标签页中打开这张图片,将其转移到缓存中,那么在网站重新加载时,背景图片就会正确显示。
继本帖之后。CSS背景图在第一次加载时不显示?我有2个网站有同样的问题。我的CSS如下。
body {
margin: 0;
padding: 0;
color: #fff;
text-align: center;
background: url(https://imgshare.io/images/2020/06/08/clothing_boutique.jpg) right bottom no-repeat;
position: relative;}
Body标签代码。
<body>
<div class="black"></div>
<div id="wrapper">
<div id="header">
<h1>Ego Café</h1>
<h2><strong class="sep-one"></strong>Better Beans. Better Coffee<strong class="sep-two"></strong></h2>
<div class="icons">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-youtube-play "></a>
</div>
</div>
<div id="middle">
<p>A relaxed and contemporary cafe bar in the centre of Palm Beach Opening this Valentine’s - 14th Feb 2014</span></p>
</div>
</div>
</body>
如何可以看到代码工作与min-heightdefault高度。
body {
margin: 0;
padding: 0;
color: #fff;
text-align: center;
background: url(https://imgshare.io/images/2020/06/08/clothing_boutique.jpg) right bottom no-repeat;
position: relative;
min-height: 100vh;
}
<body>
<div class="black"></div>
<div id="wrapper">
<div id="header">
<h1>Ego Café</h1>
<h2><strong class="sep-one"></strong>Better Beans. Better Coffee<strong class="sep-two"></strong></h2>
<div class="icons">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-youtube-play "></a>
</div>
</div>
<div id="middle">
<p>A relaxed and contemporary cafe bar in the centre of Palm Beach Opening this Valentine’s - 14th Feb 2014</span></p>
</div>
</div>
</body>
解决了!我把图片url的https改成了http.现在工作了。