为什么transition: all 1s;没有效果呢?


<div class="right">
        <div>
          <a>
            <span>远程桌面管理器数据表</span>
            <span class="iconfont icon-xiafan"></span>
          </a>
          <img
            src="../../../assets/images/products/remote-desktop-manager-datasheet-en.jpg"
            alt=""
          />
        </div>
    </div>
<style>
        .right{

        }
        .right>div{
            width: 100px;
            height: 180px;
            position: relative;
            transition: all 1s;
        }
        .right>div a{
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: aqua;
            display: none;
            top:0px;
            left:0px;
            transition: all 1s;
        }
        .right>div:hover a{
            display: block;
        }
        .right img{
            width: 100%;
            height: 100%;
            background-color: red;
        }
    </style>

transtion过渡无法控制display属性,如果你的样式里写的有display的话过渡就会失效,你可以用opacity属性或者使用width和height的方式控制它的显示和隐藏