div的对齐显示

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            .ourter2{
                width: 100px;
                height: 100px;
                margin: 20px;
                background-color: #0000FF;
                padding: 100px;
                /* border: 1px solid white; */
            }
            .inner4{
                width: 100px;
                height: 100px;
                background-color: #008000;
                /* margin: 150px 150px 150px 150px; */
                /* border: 0px solid #0000FF; */
                /* text-align: center;
                line-height: 50px;      
                word-break: break-word; */
                display:table-cell;
                vertical-align: middle;
                word-break: break-word;
                text-align: center;
                /* overflow: hidden; */
            }
            
        </style>
    </head>
    <body>
        <div class="ourter2">
            <div class="inner4">
                123456 dsafhd 
            </div>
        </div>
    </body>
</html>

 

posted @ 2019-12-27 11:10  Nobility  阅读(122)  评论(0编辑  收藏  举报