请老师检查

来源:2-9 自由编程

weixin_慕斯卡6086637

2021-03-19 11:06:23

<!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>小黄鸭</title>

    <style>

        * {

            margin0;

            padding0;

        }

        .box {

            width300px;

            height240px;

            margin20px auto;

            overflowhidden;

            positionrelative;

        }


        .box img {

            width300px;

            height240px;

        }


        .box p {

            positionabsolute;

            top240px;

            left0;

            width290px;

            height30px;

            padding-left10px;

            background-colorrgba(000.3);

            transitiontop 1s linear 0s;

            line-height30px;

        }


        .box:hover p {

            top210px

        }

    </style>

</head>

<body>

    <div class="box">

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

        <p>这是一只小黄鸭</p>

    </div>

</body>

</html>


写回答

1回答

好帮手慕星星

2021-03-19

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

0

0 学习 · 15276 问题

查看课程