请老师检查。谢谢。

来源:4-11 自由编程

慕斯卡2474635

2021-06-06 22:42:38

/* Gallery区域 */

.gallery .short h2 {

    font-size32px;

    text-aligncenter;

}

.gallery .short p {

    text-aligncenter;

    colorgray;

    font-size14px;

}

.gallery .picture {

    padding21.5px 20px;

    width1160px;

    height610px;

    margin0 auto;

}

.gallery .picture dl {

    floatleft;

    margin-right40px;

    margin-bottom30px;

}

.gallery .picture dl.none {

    margin-right0;

}

.gallery .picture dl img {

    width360px;

    height240px;

    displayblock;

}

.gallery .picture dl dd {

    height50px;

    width340px;

    background-colorblack;

    colorwhite;

    line-height50px;

    padding-left20px;

}


/* Footer区域 */

footer {

    margin-top10px;

    width100%;

    height80px;

    background-color#07cbc9;

    text-aligncenter;

    line-height80px;

}





    <!-- Gallery区域 -->

    <div class="gallery">

        <div class="short">

            <h2>GALLERY</h2>

            <div class="dividing-line"></div>

            <p> Lorem Ipsum is simply dummy text of the printing and typesetting <br> industry. Lorem Ipsum has been the industry's standard dummy <br> text ever since the 1500s.</p>

        </div>

        

        <div class="picture">

            <dl>

                <dt>

                    <img src="images/03-01.jpg" alt="">

                </dt>

                <dd>Science Lab</dd>

            </dl>

            <dl>

                <dt>

                    <img src="images/03-02.jpg" alt="">

                </dt>

                <dd>Indoor Stadium</dd>

            </dl> 

            <dl class="none">  

                <dt>

                    <img src="images/03-03.jpg" alt="">

                </dt>

                <dd>Transportation</dd>

            </dl>

            <dl>

                <dt>

                    <img src="images/03-04.jpg" alt="">

                </dt>

                <dd>Kids Room</dd>

            </dl>

            <dl>

                <dt>

                    <img src="images/03-05.jpg" alt="">

                </dt>

                <dd>Meditation aclasses</dd>

            </dl>

            <dl class="none">

                <dt>

                    <img src="images/03-06.jpg" alt="">

                </dt>

                <dd>Kids Play Ground</dd>

            </dl>

        </div>

    </div>


    <!-- Footer区域 -->

    <footer>

        <div>&copy;2016 imooc.com 京ICP备13046642号</div>

    </footer>





为什么footer如果不设置   margin-top10px;

文字就不能居中显示

写回答

1回答

好帮手慕星星

2021-06-07

同学你好,代码布局以及实现效果很棒!

针对提问回复:

文字不能居中显示是因为上面元素超出了,覆盖footer一部分

http://img.mukewang.com/climg/60bd8af109ca82c019070190.jpg

picture元素设置高度610px小了,元素超出了。建议去掉固定高度,用overflow属性消除浮动的影响:

http://img.mukewang.com/climg/60bd8b7a09a6551403260199.jpg

http://img.mukewang.com/climg/60bd8b8909a1286903280198.jpg

祝学习愉快!

0

0 学习 · 15276 问题

查看课程