CSS教程

关注公众号 jb51net

关闭
网页制作 > CSS > CSS教程 >

CSS line-height的如何继承的问题

Milk595

Line-height的如何继承?

核心代码演示:

初始化

<style>
    body{
        font-size: 20px;
    }
    p {
        background-color: #ccc;
        font-size: 16px;
    }
    </style>
</head>
<body>
    <p>这是一行文字</p>
</body>

写具体数值

  body{
        font-size: 20px;
        line-height: 50px;
    }
    p {
        background-color: #ccc;
        font-size: 16px;
    }

写比例

  body{
        font-size: 20px;
        line-height: 1.5;
    }
    p {
        background-color: #ccc;
        font-size: 16px;
    }

写百分比 先算后继承!

body{
        font-size: 20px;
        line-height: 200%;
    }
    p {
        background-color: #ccc;
        font-size: 16px;
    }

到此这篇关于CSS line-height的如何继承的问题的文章就介绍到这了,更多相关CSS line-height继承内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!