day7 02 土豆做法

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    * {
        margin: 0;
        padding:0;
    }
    a {
        display: block;
        width: 448px;
        height: 252px;
        margin: 100px;
        position: relative;
    }
    .mask {
        height: 100%;
        width: 100%;
        position: absolute;
        background:rgba(0,0,0,.4) url(images/arr.png) no-repeat center;
        top: 0;
        left: 0;
        display: none; 
        /* 先隐藏元素 */
    }
    /* 什么时候出来,鼠标经过a的时候a里面的mask出来 */
        a:hover .mask {
        /* 鼠标经过了a,里面的mask显示出来,所以这里要使用后代选择器 */
        display: block;
        }
    </style>
</head>
<body>
    <a href="#">
        <img src="images/tudou.jpg" height="252" width="448" alt="">
        <div class="mask"></div>
    </a>
</body>
</html>

效果图如下:

猜你喜欢

转载自www.cnblogs.com/fhtax/p/12230412.html