Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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和CSS制作带有悬停效果的图像链接?_Html_Css_Image_Hyperlink - Fatal编程技术网

HTML和CSS制作带有悬停效果的图像链接?

HTML和CSS制作带有悬停效果的图像链接?,html,css,image,hyperlink,Html,Css,Image,Hyperlink,我删掉了一堆代码,以了解我需要的帮助,我有一个图像,当我在上面悬停时,它会改变图像,但是当我点击该图像时,它会带给你什么,比如说mywebsite.com?? 代码: <html> <head> <style> #buttonOne {width:140px;height:60px;background-image:url(buttonOne.png);} #buttonOne:hover {width:140px;h

我删掉了一堆代码,以了解我需要的帮助,我有一个图像,当我在上面悬停时,它会改变图像,但是当我点击该图像时,它会带给你什么,比如说mywebsite.com??

代码:

<html>
  <head>
    <style>
       #buttonOne {width:140px;height:60px;background-image:url(buttonOne.png);}
       #buttonOne:hover {width:140px;height:60px;background-image:url(buttonOneH.png);}
       #buttonTwo {width:140px;height:60px;background-image:url(buttonTwo.png);}
       #buttonTwo:hover {width:140px;height:60px;background-image:url(buttonTwoH.png);}
       #buttonThree {width:140px;height:60px;background-image:url(buttonThree.png);}
       #buttonThree:hover {width:140px;height:60px;background-image:url(buttonThreeH.png);}
    </style>
  </head>
  <body>    
      <div id="buttonOne">
      </div>

      <div id="buttonTwo">
      </div>

      <div id="buttonThree">
      </div>    
  </body>
</html>

#buttonOne{宽度:140px;高度:60px;背景图像:url(buttonOne.png);}
#buttonOne:悬停{宽度:140px;高度:60px;背景图像:url(buttonOneH.png);}
#buttonTwo{宽度:140px;高度:60px;背景图像:url(buttonTwo.png);}
#buttonTwo:悬停{宽度:140px;高度:60px;背景图像:url(buttonTwoH.png);}
#ButtontTree{宽度:140px;高度:60px;背景图像:url(ButtontTree.png);}
#ButtontTree:悬停{宽度:140px;高度:60px;背景图像:url(buttonThreeH.png);}

将那些
div
s改为
a
标签。这就是他们的目的。如果您想要一个可以单击转到另一个url的元素,则需要一个
将那些
div
s改为
a
标签。这就是他们的目的。如果您想要一个可以单击转到另一个url的元素,则需要一个
使用锚定标记,您可以这样做-

<a id="buttonOne" href="mywebsite.com"></a>
...

使用锚定标记可以这样做-

<a id="buttonOne" href="mywebsite.com"></a>
...

我不确定你们说的是什么abotu removign这些divs对我来说不起作用,我所做的是在那些空的divs里面,我在一个看不见的链接图像中添加了这些divs

<div id="buttonOne">
<a href="mywebsite.com" target="_blank"><img src="inbut.png">
</a>
</div>

我不确定你们说的是什么abotu删除了这些div,对我来说不起作用,我所做的是在那些空div中添加了一个不可见的链接图像

<div id="buttonOne">
<a href="mywebsite.com" target="_blank"><img src="inbut.png">
</a>
</div>


it’s will to let say mywebsite.com你是什么意思it’s will to let say mywebsite.com没有理由使用内联样式。只要id保持不变,发布的CSS就可以正常工作。我刚才给出了一个示例,dint地址指定的代码。将对其进行编辑。没有理由使用内联样式。只要id保持不变,发布的CSS就可以正常工作。我刚才给出了一个示例,dint地址指定的代码。我将编辑它。