老师 求指导

老师 求指导

<!DOCTYPE html>

<html>

<head>

        <!-- 此处编写样式 -->

        <meta charset="utf-8"/>

        <style>

        

        *{margin:0; padding:0;}

       


        .two,.three{

            overflow: hidden;

            zoom: 1;

            padding: 20px;

        


           

        

            }

        

        .content{ 

            float: left;

            padding: 10px;

            margin: 5px;

            border: 1px solid gray;

           

          

        }               

            .one{

               width:50%;

               text-align:center;

                border: 1px gray dashed;

                margin: 0 25% 0;}

         

        </style>

        

</head>

<body>   

    <div class="one"> 




    <div class="two">

<div class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe9770001e63102400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>


<div class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe97d00011bda02400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>


<div class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe9770001e63102400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>

    </div>


<div  class="three">


<div   class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe9770001e63102400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>


<div  class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe97d00011bda02400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>


<div  class="content">

    <img src="http://img1.sycdn.imooc.com\/climg/590fe982000150ba02400135.jpg"/>

                    <p>欢迎来到慕课网学习</p>

</div>


</div>

</div>


</body>

</html>



正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,同学最外层父元素的宽度设置的不对,因为每一列的宽度为240(图片宽度)+20(左右padding)+2(左右边框)+ 10(左右margin)为272px,那么三列的宽度为816px,而two容器又设置了左右padding各20px,那么总的宽度就为816+40=856px,参考:

http://img1.sycdn.imooc.com//climg/5e5100690984fd6505160205.jpg

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

  • 哈哈9730504 提问者 #1
    老师 应该不能吧左右margin乘3吧 两个图片中间的margin会相互覆盖 也就是说margin就是5+5+5+5 咱们如果直接用刚才乘3是不是就多算了两个margin为5的
    2020-02-22 18:34:41
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师