【问题标题】:css transition (hover and after)css 过渡(悬停和之后)
【发布时间】:2021-12-23 16:26:53
【问题描述】:

我想做这样的事情: 当光标转到 .list-menu 时,.list-menu::after 将是

content: '';
display: block;
width: 50px;
height: 2px;
background-color: black;

所以我写了这样的代码: (photo link)

.list-menu::after {
    transition: all 5s ease;
}
.list-menu:hover .list-menu::after {
    content: '';
    display: block;
    width: 50px;
    height: 2px;
    background-color: black;
}

但这不起作用,请帮助我

【问题讨论】:

    标签: html css properties styles css-transitions


    【解决方案1】:
    .list-menu:hover:after{
        content: '';
        display: block;
        width: 50px;
        height: 2px;
        background-color: black;
    }
    

    https://jsfiddle.net/Markov88/xbvp4oys/8/

    【讨论】:

      猜你喜欢
      • 2011-11-10
      • 2018-01-22
      • 2021-05-17
      • 2016-10-24
      • 2014-08-19
      • 2017-04-03
      • 2011-10-08
      • 1970-01-01
      相关资源
      最近更新 更多