老师看下这样可以吗?2-5

来源:2-5 编程练习

Rain_2020

2019-11-17 12:07:59

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">  

    <title>CSS布局</title>

    <style type="text/css">

        .box{

            width: 500px;

            height: 200px;

            margin:0 auto;

            border:1px solid #aaa;

            background-color: #ababab;

            color: #fff;           

            font-weight: bolder;    

            position: relative;

            display: table; 

        }

        .box div{

            width: 200px;

            height: 40px;

            font-size: 16px;

            text-align: center;

            /*此处写代码*/

            display: table-cell;

            vertical-align: middle;

        }

    </style>

</head>

<body>

    <div class="box">

        <div>

            欢迎大家来到慕课网学习!<br/>

            来到慕课网学习!

        </div>

    </div>

</body>

</html>


写回答

1回答

好帮手慕夭夭

2019-11-17

同学你好,代码实现正确。继续加油,祝学习愉快~

0
hain_2020
h 好的 谢谢 老师
h019-11-17
共1条回复

0 学习 · 40143 问题

查看课程