其他分享
首页 > 其他分享> > 半透明遮罩

半透明遮罩

作者:互联网

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>demo</title>
    <style>
        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 0.1s;
        }

        div:hover {
            box-shadow: 0 0 0 50vmax rgba(0, 0, 0, 0.5);
            /*transform: translate(-50%, -60%);*/
        }
    </style>
</head>

<body>
    <div>Hover Me</div>
</body>

</html>

 

标签:遮罩,50%,transform,60px,height,div,translate,半透明
来源: https://www.cnblogs.com/MarHangover/p/15834837.html