11-2·100 单行文字垂直居中

 

  

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>垂直居中</title>
    <style>
        .demo {
            width: 200px;
            /* div盒子高度 */
            height: 40px;
            background-color: blue;
            /* 行高度 */
            line-height: 40px;
        }
    </style>
</head>

<body>
    <div class="demo">文字居中</div>
</body>

</html>

效果

    

 

posted @ 2022-02-09 15:25  优敏行  阅读(28)  评论(0)    收藏  举报