我刚刚添加了几个社交媒体图标到我的网站。它们在safari和firefox中显示效果不错,但不是在Chrome中显示效果。.png图片不显示在铬
我发现一个可能的答案可能是如何处理png文件的保存方式。有谁知道为什么这会影响铬是否能够显示图像?或者是我的代码中的东西?
section #contact .icon {
height: 50px;
width: 50px;
float: center;
padding: auto;
margin: 10% auto;
}
section #contact #instagram {
background-image: url(images/instagram.png);
background-size: contain;
display: block;
float: center;
width: 100%;
height: 100%;
}
section #contact #instagram:hover {
background-image: url(images/instagram-grey.png);
}
section #contact #facebook {
background-image: url(images/facebook.png);
background-size: contain;
display: block;
float: center;
width: 100%;
height: 100%;
}
section #contact #facebook:hover {
background-image: url(images/facebook-grey.png);
}
<section class="content" id="contact">
<a class="anchortag" name="Contact"></a>
<h3>Contact</h3>
<!-- email -->
<p><a href="mailto:emailaddress" aria-haspopup="true">email</a>
</p>
<!-- Facebook -->
<div class="icon">
<a id="facebook" title="facebook" href="https://www.facebook.com/" aria-haspopup="true" target="_blank"></a>
</div>
<!-- Instagram -->
<div class="icon">
<a id="instagram" title="instagram" href="https://www.instagram.com/" aria-haspopup="true" target="_blank"></a>
</div>
</section>
可能是浏览器缓存。尝试清除您的缓存在铬的设置 – amallard
我会使用精灵而不是个别图像。对于单个图像,直到悬停状态时才会请求悬停图像。在第一次悬停时下载图像时,这可能会导致闪烁。 – hungerstar