div等高布局

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>实际是将其转为table</title>
        <link rel="stylesheet" href="plugins/bootstrap/css/bootstrap.min.css" />
        <style>
            .div{
                border: 1px solid saddlebrown;
                border-spacing: 15px;
                width: 30%;
                display: table;
            }
            .div1{
                display: table-cell;
                width: 100px;
                height:150px;
                background-color: royalblue;
                vertical-align: middle;
            }
            .div2{
                display: table-cell;
                border: 1px solid seagreen;
                padding:10px;
            }
        </style>
    </head>
    <body>
        <div class="div">
            <div class="div1"></div>
            <div class="div2">
                发舒服舒服舒服舒服水电费
                发舒服舒服舒服舒服水电费
                发舒服舒服舒服舒服水电费
                发舒服舒服舒服舒服水电费
                发舒服舒服舒服舒服水电费
                发舒服舒服舒服舒服水电费
            </div>
        </div>
    </body>
</html>

 

posted @ 2019-09-12 14:06  littleboyck  阅读(485)  评论(0编辑  收藏  举报