图像悬停功能(css)找不到图像

时间:2014-04-10 16:25:24

标签: html css image mouseover

我想要一个带有图像和链接的按钮。这是我的样式代码:

<style>
    twitter{

    display:block;
    background-image: url('CIMA/Social/Twitter.png');
    width: 30%;
    height: 30%;
}
</style>

和我的身体代码:

<twitter href="#"> &nbsp; </twitter>

但它没有显示任何图像。我尝试了很多不同的图像路径,但它不会显示......

2 个答案:

答案 0 :(得分:0)

哦。为什么不

<a href="#"><img src= "cima/social/twitter.png" /> </a>
<style>
a img {width:30%;height:30%;}
</style>

答案 1 :(得分:0)

您使用自定义(无效)元素时HTML无效。尝试

<强> HTML

<a class="twitter" href="#"> &nbsp; </a>

<强> CSS

.twitter{

    display:block;
    background-image: url('CIMA/Social/Twitter.png');
    width: 30px; /* or whatever value */
    height: 30px;
}