请老师检查一下代码是否符合要求?

来源:2-7 编程练习

weixin_慕设计1308382

2020-07-16 16:42:07

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>CSS布局</title>
    <style type="text/css">
        /*此处写代码*/
        *{
            margin: 0;
            padding: 0;
        }
        .word{
            padding-top: 100px;
            text-align: center;
            font-size: 25px;
        }
        .container .bottom{
            width: 1000px;
            margin: 0 auto;
        }
        .container .bottom .element .picture{
            width: 426px;
            float: left;
            padding-top: 30px;
            margin: 10px;
        }
        .container .bottom .element .description{
            font-size: 14px;
            text-align: center;
        }
    </style>
</head>
<body>
<!-- 此处写代码 -->
<div class="container">
    <div class="word">ENJOY THE LIFE</div>
    <div class="bottom">
        <div class="element">
            <div class="picture">
                <img src="http://climg.mukewang.com/58f829090001a4b504260240.jpg">
                <div class="description">
                    Life is like a book, just read more and more<br>
                    refined, more write more carefully. When read,<br> mind open, all things have been indifferent to <br>
                    heart. Life is the percipitation.
                </div>
            </div>
            <div class="picture">
                <img src="http://climg.mukewang.com/58f8290f0001558804260240.jpg">
                <div class="description">
                    Life is like a book, just read more and more<br>
                    refined, more write more carefully. When read,<br> mind open, all things have been indifferent to <br>
                    heart. Life is the percipitation.
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>


写回答

1回答

好帮手慕码

2020-07-16

同学你好,因为bottom部分的宽度设置不合适,导致没有实现水平居中。建议修改:

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

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

1

0 学习 · 40143 问题

查看课程