CSS skills: box-shadow to achieve translucent mask

Insert picture description here

<p>背景文字背景文字背景文字背景文字</p>
<div>Hover Me</div>
div {
    
    
    position: absolute;
    width: 200px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    border: 1px solid #666;
    cursor: pointer;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all .1s;
}

div:hover {
    
    
    box-shadow: 0 0 0 50vmax rgba(0, 0, 0, .5);
    transform: translate(-50%, -60%);
}

Guess you like

Origin blog.csdn.net/m0_47883103/article/details/108629064