Javascript 如何将背景gif放入<;a>;悬停时链接
悬停链接时如何放置背景图像Javascript 如何将背景gif放入<;a>;悬停时链接,javascript,jquery,html,css,Javascript,Jquery,Html,Css,悬停链接时如何放置背景图像 使用css psudo类选择器并设置属性 a:hover { background-image : url(img.png); } a:悬停{ 背景图片:url(https://placehold.it/100x15); } 试试这个CSS a:悬停{ 背景:url(“http://wallpaper-gallery.net/images/grey-wallpaper-hd/grey-wallpaper-hd-23.jpg"); //将URL替换为所需
使用css psudo类选择器并设置属性
a:hover {
background-image : url(img.png);
}
a:悬停{
背景图片:url(https://placehold.it/100x15);
}
试试这个CSS
a:悬停{
背景:url(“http://wallpaper-gallery.net/images/grey-wallpaper-hd/grey-wallpaper-hd-23.jpg");
//将URL替换为所需的Bg图像
}
您需要将锚定标记的“显示”属性设置为“阻止”,并为其提供背景填充高度 HTML:
您能给我们看一下您尝试的代码吗?
:悬停
和背景图像
会有帮助
a:hover {
background-image : url(img.png);
}
<html>
<head> </head>
<body>
<a href="#">Insert Bg in this a when hover</a>
</body>
</html>
a{
display : block;
height : 100px;
}
a:hover{
background : url('http://i.giphy.com/xUySTCEXzJdGCeIj3W.gif');
}