CSS Sprite 不起作用

标签 css css-sprites sprite

我需要在我的 html 页面上嵌入社交网络 sprite,但由于某些原因它们不显示(而链接本身有效)。这是我的 html:

<div class="sprites">
    <a class="instagram" href="http://instagram.com"></a>
    <a class="twitter" href="https://twitter.com"></a>
    <a class="facebook" href="https://fb.com"></a>
    <a class="vk" href="https://vk.com"></a>
    <a class="pinterest" href="https://pinterest.com"></a>
    <a class="youtube" href="https://youtube.com"></a>
</div>

并摆弄 scss:http://jsfiddle.net/zvj89o0o/ 下面是我的 Sprite 的样子:

enter image description here

最佳答案

试试这个:

.youtube, .pinterest, .vk, .facebook, .twitter, .instagram {
    width: 105px;
    height: 105px;
    background: url("path/to/jI86i.png") 0 0 no-repeat;
    -webkit-transition: all 300ms ease-in-out;
    -moz-transition: all 300ms ease-in-out;
    transition: all 300ms ease-in-out;
}

关于CSS Sprite 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28000248/

相关文章:

css - 大 CSS Sprite 图像(在低 CPU 计算机上运行缓慢)

Python 动画时序

objective-c - 如何在 iOS 中切片/剪切 Sprite (Core Graphics)

javascript - 为什么 Chrome 在某些情况下会在主线程上运行转换动画,而在其他情况下则不会?

javascript - 单击按钮不会调用 javascript 文件

javascript - IE6 : Background-Image Load Event

css - 使用 CSS Sprite 的下一个上一个按钮

flutter - 如何为图像添加透明度

html - div中的动态图像尺寸

javascript - fullCalendar.js : align events in the same horizontal line