【问题标题】:Fade effect during hover - border-radius doesn't wok悬停期间的淡入淡出效果 - 边界半径不起作用
【发布时间】:2013-12-02 19:08:45
【问题描述】:

用 CHROME 看看这个jFiddle。 谁能帮我解决这个问题?我不想在过渡期间看到图像的角落。 如果可能的话,我更喜欢不使用 jQuery :) 谢谢!

CSS

#cf {
  position:relative;
  height:300px;
  width:300px;
  margin:0 auto;  
  border-radius:50%; 
   overflow:hidden;
    border: 10px solid red;
}

#cf img {
  position:absolute;
  left:0;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

#cf img.top:hover {
  opacity:0;
}

HTML

<div id="cf">
  <img class="bottom" src="http://www.world-science.org/wp-content/uploads/2011/07/Lion_300.jpg" />
  <img class="top" src="http://bioexpedition.com/wp-content/uploads/2012/06/Sea-Turtle-Anatomy.jpg" />
</div>

jFiddle

【问题讨论】:

    标签: html css hover fade


    【解决方案1】:

    在我看来,这就像 Chrome 中的一个错误。

    您可以通过setting the same border-radius on the image 解决它。

    #cf img {
      border-radius:50%; 
      overflow:hidden;
    }
    

    【讨论】:

    • 与我得出的结论完全相同。 OP:这是正确的答案。
    猜你喜欢
    • 2015-09-02
    • 1970-01-01
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2013-08-31
    相关资源
    最近更新 更多