简体   繁体   English

关于动画悬停解决方案查询的CSS3

[英]CSS3 on animation hover solution inquiry

Please take a look at this link, http://codepen.io/funhyun/pen/eLmFp . 请查看此链接, http://codepen.io/funhyun/pen/eLmFp

I am trying to achieve a css3 hover animation effect where upon hovering the thumbnail, the black color overlays with the carot to click animates in. At the moment, when you hover the image, nothing happens. 我正在尝试实现css3悬停动画效果,在悬停缩略图时,黑色覆盖着carot点击动画。此时,当你悬停图像时,没有任何反应。 However, if you remove the IMG tag on line 3 of the html code, then it works. 但是,如果您删除html代码的第3行上的IMG标记,则它可以正常工作。 How can I make it animate with the image? 如何使其与图像一起动画? Any help is greatly appreciated!! 任何帮助是极大的赞赏!!

Its working but the overlay is moved below the image. 它工作但叠加层移动到图像下方。 If you remove overflow: hidden of #box, you can see it working. 如果您删除了溢出:隐藏的#box,您可以看到它正常工作。

you need to give position: absolute to the overlay. 你需要给位置:绝对覆盖。

check this 检查一下

I have used your same code of your's. 我使用了你的相同代码。

Your problem is, that your overlay div isn't over the image, it's under it. 你的问题是,你的叠加div不在图像上,它在它下面。 Solved by removing the image tag and adding the image as background-image to #box, see here Hope i could help :) 通过删除图像标记并将图像作为背景图像添加到#box解决,请参阅此处希望我可以帮助:)

You can use this css. 你可以使用这个CSS。 it will work fine 它会工作正常

  #box    {  width:300px;
               height:200px;
              margin:5% auto 0 auto; 
              overflow:hidden;
               position:relative;
                background: #ccc;}

    #overlay    {  background:#333;
                   text-align:center;
                   padding:45px 0 66px 0;
                   opacity:0;
                    position:absolute;

                top:0px;
                right:0px;
                left:0px;
                   -webkit-transition: opacity .25s ease;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM