Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将背景gif放入<;a>;悬停时链接_Javascript_Jquery_Html_Css - Fatal编程技术网

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');
}