请老师帮我批改一下作业

来源:4-10 自由编程

好学生慕小帅

2021-07-28 20:28:42

HTML代码:

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

    <link rel="stylesheet" href="css.css">

</head>


<body>

    <div class="a">


        <div class="img"><img src="b1.jpg" alt=""></div>


        <div class="content">

            <h2>Library</h2>

            <p class="p1">Lorem Ipsum is simoly dummy text of the printing and typesetting industry</p>

            <p class="p2">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer

                took a galley of type and scrambled it to make a type specimen book.</p>

            <button>EXPLORE</button>

        </div>


        <div class="img"><img src="b2.jpg" alt=""></div>


        <div class="content" id="c">

            <h2>Library</h2>

            <p class="p1">Lorem Ipsum is simoly dummy text of the printing and typesetting industry</p>

            <p class="p2">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer

                took a galley of type and scrambled it to make a type specimen book.</p>

            <button>EXPLORE</button>

        </div>


        <div class="content">

            <h2>Library</h2>

            <p class="p1">Lorem Ipsum is simoly dummy text of the printing and typesetting industry</p>

            <p class="p2">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer

                took a galley of type and scrambled it to make a type specimen book.</p>

            <button>EXPLORE</button>

        </div>


        <div class="img"><img src="b3.jpg" alt=""></div>



        <div class="content">

            <h2>Library</h2>

            <p class="p1">Lorem Ipsum is simoly dummy text of the printing and typesetting industry</p>

            <p class="p2">Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer

                took a galley of type and scrambled it to make a type specimen book.</p>

            <button>EXPLORE</button>

        </div>


        <div class="img"><img src="b4.jpg" alt=""></div>

    </div>

</body>


</html>






CSS代码:

*{

    margin0;

    padding0;

}

.a{

    width100%;

}

.a div{

    width25%;

    floatleft;

}

.a .img{

    width25%;

    height380px;

}

.a .img img{

    width100%;

}

.a .content{

    width25%;

    height380px;

    background#07cbc9;

}

.a .content h2{

    font-size24px;

    margin-top20px;

    margin-left20px;

    colorwhite;

}

.a .content .p1{

    margin-top30px;

    margin-left20px;

    font-size16px;

    colorwhite;

}

.a .content .p2{

    margin-top20px;

    margin-left20px;

    font-size14px;

    colorgray;

    margin-bottom30px;

}

.a .content button{

    width138px;

    height40px;

    display:block;

    marginauto;

    line-height40px;

    background#000;

    colorwhite;

    bordernone;

}


写回答

1回答

好帮手慕然然

2021-07-29

同学你好,代码实现基本没问题,不过img图片的高度过高,超出外层盒子,在布局上多出一部分,如图

http://img.mukewang.com/climg/6102076a09e88ca219040920.jpg

建议:可以给img图片的父盒子设置overflow:hidden属性,将超出部分隐藏,参考如下

http://img.mukewang.com/climg/610207c609a2237e04340268.jpg

祝学习愉快!

0

前端工程师

前端入门如同写字,如果你不知道从哪开始,那就选择前端(含Vue3.x,React17,TS)

20327 学习 · 17877 问题

查看课程