css悬停不执行

标签 css image hover

我希望将鼠标悬停在图像上时,图像的尺寸会稍微变大。我知道这很简单,但我已经在其他示例中寻找了一个小时,但似乎无法弄清楚我遗漏了什么。感谢您的帮助。这些图片保存在我的电脑上。

适用范围

<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<embed src="73797^alarmclock.mp3"; autostart="true"; loop="true"; hidden="true";/>

<body>

     <img src ="alarm clock2.jpg"/>

     <p>  Pulling the sheets into my body, I begin to sink back into the bed... 
          uggh... my alarm clock... time to get up..

         <img style = "position:absolute; top:300px; right: 0px; z-index:1" 
          src="computer.jpg"/>

         <IMG  ID="grow" STYLE= "position:absolute; TOP:1157px; LEFT:599px; 
          WIDTH:47px; z-index:2; HEIGHT:47px" SRC="icon2.gif"/> 

</body>

</html>   

这是 stylesheet.css

#grow:hover {
width: 100px;
height: 150px;
}

最佳答案

我认为内联样式优先于 CSS。

将您的 CSS 和 HTML 更改为以下内容:

#grow {
    position:absolute;
    top:1157px; 
    left:599px; 
    width:47px;
    z-index:2;
    height:47px
}
#grow:hover {
    width: 100px;
    height: 150px;
}

HTML:

<IMG  ID="grow" SRC="icon2.gif"/> 

关于css悬停不执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18518055/

相关文章:

css - 在 CSS 中同时进行绝对和相对定位

html - Css Rotate 45 导致渐变边框中断

CSS - 图像和悬停无法正常工作

html - 影响 Web 浏览器资源加载顺序

css - 无法将 div 层定位在 html slider 之上

jquery - 在 jQuery 中,如何指定仅在特定区域执行某个功能?

javascript - 将鼠标悬停在链接上后 Mouseenter 失败

html - 制作坟墓形状。我该怎么做?

html - 设置每个 Column DIV 控件的固定宽度

jquery - 如果父元素也有鼠标悬停,如何为子元素触发鼠标悬停事件?