行高

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>行高</title>
        <style>
            /* 
                文本在网页中显示时,CSS会为每一个文本行都设置一个文本框,以容纳这些文字
             */
            div{
                height: 100px;
                border:1px red solid;
                font-size: 50px;
                /* 通过line-height来设置行高 */
                /* line-height: 100px; */
                
                /* 行高可以直接设置一个整数,则行高等于字体的大小的倍数 */
                /* line-height: 1; */
                
                /* 
                    在文字框中,文字并不是贴着行的底部排列,它是沿着行框的基线(base-line)排列的,文字
                        基本是在行高中居中显示的
                 */
            }
        </style>
    </head>
    <body>
        <div>你好 Hello</div>
    </body>
</html>

 

posted @ 2022-05-16 20:37  氯丙嗪  阅读(5)  评论(0编辑  收藏  举报