老师帮忙看看代码是否正确

来源:4-3 编程练习

能量咕噜略略

2020-01-03 12:19:20

在css样式中添加了图片的url地址,是不是在块元素div里就可以不用添加了。

<!DOCTYPE html>

<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>

        .content{

            width:100%;

            height:4033px;

            background:url(http://climg.mukewang.com/59c9f7ce0001839219034033.png) no-repeat;

            position: relative;

        }

        /* .picture:nth-child(1){

            width:224px;

            height:364px;

            background:url(http://climg.mukewang.com/5a3383c70001f1b702240364.png);

            position: fixed;

            left:1679px;

            top:50%;

            margin-top:-182px;

        }

        .picture:nth-child(2){

            width:224px;

            height:364px;

            background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png);

            position: fixed;

            top:50%;

            margin-top:-182px;

        } */

        .picture:nth-child(1){

            position:fixed;

            width:224px;

            height:364px;

            background:url(http://climg.mukewang.com/5a3383c70001f1b702240364.png);

            top:50%;

            right:0;

            margin-top:-182px;

        }

        .picture:nth-child(2){

            position:fixed;

            width:224px;

            height:364px;

            background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png);

            top:50%;

            left:0;

            margin-top:-182px;

        }

    </style>

</head>

<body>

    <div class="content"> 

        <div class="picture"></div>

        <div class="picture"></div>

    </div>

</body>

</html>


写回答

1回答

好帮手慕夭夭

2020-01-03

同学你好,同学说的在div中添加指的是设置img标签吗?已经设置背景图就不需要了。

另外,代码实现正确。继续加油,祝学习愉快~

0

0 学习 · 40143 问题

查看课程