【问题标题】:How to add hover transition while targeting class with ">"如何在使用“>”定位类时添加悬停过渡
【发布时间】:2018-12-29 11:07:54
【问题描述】:

我正在尝试添加过渡,但无法使其正常工作。我的悬停工作略有不同,因为它针对不同的类进行更改,它是:

.news-thumbnail:hover > .news-description-container{
padding: 1.5rem 2rem;
height: 21rem;  
-webkit-transition: all 2s linear;
-moz-transition: all 2s linear;
-o-transition: all 2s linear;
transition: all 2s linear;
}

Edit: adding original class    

.news-description-container{
position:absolute;
width: 100%;
bottom: 0;
border-bottom-right-radius: 1rem;
border-bottom-left-radius: 1rem;
background-color: white;
padding:2.5rem 2rem;
text-align: left;
height: 15.5rem;
}

这使得: https://i.stack.imgur.com/DyeOS.png

当您将鼠标悬停在其中时(新闻缩略图),只需白色区域(新闻描述容器)向上滑动: https://i.stack.imgur.com/Q6mxf.png

我怎样才能使这个过渡工作?我只是希望它上下滑动,而不是在没有过渡的情况下出现/消失。

也许我做错了,不应该这样做? 谷歌搜索后没有找到任何东西,所以它可能对其他人有用。

谢谢!

【问题讨论】:

  • 你能提供你的问题的重现吗?组件的未悬停 css 应该会有所帮助

标签: css class hover transition target


【解决方案1】:

See Here...您可以使用相同样式的悬停过渡。

只需更改几个参数即可...

见代码[Here]1

【讨论】:

  • 太棒了!这个对我有用,只是稍微调整了一下 :) 非常感谢!
猜你喜欢
  • 2016-07-23
  • 2019-04-04
  • 1970-01-01
  • 2023-03-13
  • 2013-10-12
  • 1970-01-01
  • 1970-01-01
  • 2012-02-12
  • 2021-08-13
相关资源
最近更新 更多