请老师检查作业

来源:2-9 自由编程

以你为瘾丶

2021-08-13 14:12:33

<!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>Document</title>

    <style>

        *{

            margin0;

            padding0;

        }

        .box{

            width300px;

            height240px;

            margin:50px auto;

            /* 设置相对定位 */

            positionrelative;

            overflowhidden;

        }

        .box img{

            width300px;

            height240px;

            displayblock;

        }

      

        

        .box .info{

            width280px;

            height50px;

            background-colorrgba(0,0,0,.2);

            font-size20px;

            padding-left20px;

            line-height50px;

            /* 设置绝对定位 */

            positionabsolute;

            bottom:-50px;

            transitionbottom 1s linear ;

            colorwhite;

            

           

        }

        .box:hover .info{


            bottom0px;

        }

      

    </style>

</head>

<body>

    <div class="box">

        <img src="images/duck.png" alt="">

        <div class="info">这是一只小黄鸭</div>

    </div>

</body>

</html>


写回答

1回答

好帮手慕星星

2021-08-13

同学你好,代码实现效果很棒。继续加油,祝学习愉快!

0

0 学习 · 17877 问题

查看课程