How can I put background image when I hover a link
<html>
<head> </head>
<body>
<a href="#">Insert Bg in this a when hover</a>
</body>
</html>
最佳答案
你需要设置 anchor 标签的display属性为block,并给它一个背景填充的高度。
HTML:
<html>
<head> </head>
<body>
<a href="#">Insert Bg in this a when hover</a>
</body>
</html>
CSS:
a{
display : block;
height : 100px;
}
a:hover{
background : url('http://i.giphy.com/xUySTCEXzJdGCeIj3W.gif');
}
关于javascript - 悬停时如何将背景 gif 放在 <a> 链接中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42436963/