这样子对吗

来源:2-7 编程练习

慕雪9046520

2020-04-13 22:03:30

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

        *{

            margin: 0;

            padding:0;

        }

    .main{

        width:100%;

    }

    h2{

        text-align: center;

    }

    .main .comm{

        width: 50%;

        float: left;

        box-sizing: border-box;

        padding-left: 100px;

    }

    .main .comm img{

        width: 426px;

        height: 240px;

    }

    .main .desc{

        width: 426px;

    }

    </style>

</head>

<body>

    <div class="main">

    <h2>ENJOY THE LIEF</h2>

    <div class="pic1 comm">

        <img src="http://climg.mukewang.com/58f829090001a4b504260240.jpg" alt="">

        <div class="desc">

            As the number of people using the Internet as an integral part 

            of their daily life grows, it is inevitable that the number of 

            Internet Scams will grow. Unfortunately there are many forms of

             scams but in this article we will look at three of the most prominent.

        </div>

    </div>

    <div class="pic2 comm">

        <img src="http://climg.mukewang.com/58f8290f0001558804260240.jpg" alt="">

        <p class="desc">

            As the number of people using the Internet as an integral part 

            of their daily life grows, it is inevitable that the number of 

            Internet Scams will grow. Unfortunately there are many forms of

             scams but in this article we will look at three of the most prominent.

        </p>

    </div>

    </div>

</body>

</html>


写回答

1回答

好帮手慕久久

2020-04-14

同学你好,代码正确,可以做如下优化:

图文整体不居中如下:

http://img.mukewang.com/climg/5e952e7f09bde19e05540112.jpg

可以将类名为“main”父容器设置固定宽度并居中,这样页面效果更好看,参考如下:

http://img.mukewang.com/climg/5e952e8909f0c38305540148.jpg

http://img.mukewang.com/climg/5e952e8d09cc981904940192.jpg

如果我的回答帮到了你,欢迎采纳,祝学习愉快!

0

0 学习 · 40143 问题

查看课程