Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.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
Html 如何使图像仅在我将鼠标悬停在其上时显示_Html_Css_Hover_Mouseover - Fatal编程技术网

Html 如何使图像仅在我将鼠标悬停在其上时显示

Html 如何使图像仅在我将鼠标悬停在其上时显示,html,css,hover,mouseover,Html,Css,Hover,Mouseover,我想我的图像只有当我把鼠标放在上面的时候才会出现,我试着把它放在样式部分,但它不起作用。这个代码对吗 <style type=“text/css”> img{opacity: 0;} img:hover{opacity: 1;} </style> img{opacity:0;} img:hover{opacity:1;} 您使用了错误类型的引号 将“text/css”更改为“text/css” 不正确 <style type=“text/css”> i

我想我的图像只有当我把鼠标放在上面的时候才会出现,我试着把它放在样式部分,但它不起作用。这个代码对吗

<style type=“text/css”>
img{opacity: 0;}
img:hover{opacity: 1;}
</style>

img{opacity:0;}
img:hover{opacity:1;}

您使用了错误类型的引号

“text/css”
更改为
“text/css”

不正确

<style type=“text/css”>
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>
<style type="text/css">
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>

img{
不透明度:0;
}
img:悬停{
不透明度:1;
}
正确

<style type=“text/css”>
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>
<style type="text/css">
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>

img{
不透明度:0;
}
img:悬停{
不透明度:1;
}

您使用了错误类型的引号

“text/css”
更改为
“text/css”

不正确

<style type=“text/css”>
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>
<style type="text/css">
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>

img{
不透明度:0;
}
img:悬停{
不透明度:1;
}
正确

<style type=“text/css”>
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>
<style type="text/css">
  img {
    opacity: 0;
  }

  img:hover {
    opacity: 1;
  }
</style>

img{
不透明度:0;
}
img:悬停{
不透明度:1;
}

正常工作。看起来您使用的是无法识别的引号。试着用“而不是”只是好奇?我想知道你正在使用哪个软件来编写代码……工作正常。看起来你使用的是无法识别的引号。试着用“而不是”“只是好奇——我想知道你在用哪个软件编写代码……我不知道你是怎么发现的。太好了。很多年前,当我复制粘贴一些代码示例时,代码在样式标记之外工作,但不在其中。这是一个幸运的猜测。我不知道你是怎么发现这个的。太好了。我曾经遇到过这种情况很多年前,当我复制粘贴一些代码示例时,代码在样式标记之外工作,但不在其中。这是一个幸运的猜测。