📝 代码查看
使用runcode.html页面

1
查看次数
2025-11-06
创建时间
2025-11-06
最后更新
<div>Hover Me</div>
<div>Hover Me</div>
body, html {
    width: 100%;
    height: 100%;
    display: flex;
    background: yellowgreen;
}

div {
    position: relative;
    margin: auto;
    width: 200px;
    height: 100px;
    line-height: 100px;
    text-align: center;
    overflow: hidden;
    
    &::after {
        content: "Hover Me";
        position: absolute;
        top: 4px;
        bottom: 4px;
        right: 4px;
        left: 4px;
        line-height: 92px;
        font-size: 24px;
        background: #fff;
        // border-radius: 50%;
        border: 2px solid yellowgreen;
        cursor: pointer;
        color: yellowgreen;
    }
    
    &::before {
        content: "";
        position: absolute;
        top: 0px;
        bottom: 0px;
        right: -20px;
        left: 0px;
        background: #fff;
        //border-radius: 50%;
        transform: rotateZ(-90deg) translate(-100%, -100%);
        transform-origin: top left;
        transition: transform .3s;
        transition-timing-function: linear;
    }
    
    &:hover {
        filter: contrast(1.2);
    }
    
        &:hover::before {
            transform: rotateZ(0deg) translate(0%, -0%);
        }
}

div:nth-child(2) {
    overflow: unset;
    
    &::after {
        content: "";
    }
}

div:nth-child(1):hover ~ div:nth-child(2)::before {
    transform: rotateZ(0deg) translate(0%, -0%);
}
    
暂无JavaScript代码

👁️ 实时预览