当前位置:网站首页>Value of line height
Value of line height
2022-06-13 03:50:00 【_ Virgo programmer's daily life】
The value of row height
line-height
px, Pixel values
Numbers without units
em Company
percentage
Focus on setting the parent element to em Influence of and numbers on child elements
.container {
/* The line height is twice the font size */
/* First calculate the pixel value , Re inheritance */
line-height: 2em;
}
.p1{
font-size: 40px;
}
.p2{
font-size: 12px;
}
</style>
<body>
<div class="container">
<p class="p1">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet molestiae sed doloremque sapiente? Explicabo, quidem itaque, repudiandae fugiat impedit suscipit, amet inventore necessitatibus pariatur iste quisquam laborum hic aperiam ab.
</p>
<p class="p2">
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tenetur earum corporis, eius, ut ratione nihil exercitationem cum voluptatibus et velit repellat debitis esse praesentium odio provident ex totam, delectus expedita.
</p>
</div>
</body>
explain : Here, the parent element line-height by 2em, The line height is twice the font size , Oneself font-size Inherits the browser default size 16px,line-height by 2 times , Then for 32px, Subelement p1,p2 All inherited div Of line-heigh by 32px;
.container {
/* The line height is twice the font size */
/* Inherit first , Calculate again */
line-height: 2;
}
.p1{
font-size: 40px;
}
.p2{
font-size: 12px;
}
</style>
</head>
<body>
<div class="container">
<p class="p1">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet molestiae sed doloremque sapiente? Explicabo, quidem itaque, repudiandae fugiat impedit suscipit, amet inventore necessitatibus pariatur iste quisquam laborum hic aperiam ab.
</p>
<p class="p2">
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tenetur earum corporis, eius, ut ratione nihil exercitationem cum voluptatibus et velit repellat debitis esse praesentium odio provident ex totam, delectus expedita.
</p>
</div>
</body>

explain :
div Of line-height by 2,p1 and p2 All inherited , Then calculate according to their own size , Respectively :40 * 2=80px,12 * 2=24px.
notes : In development, we often set the row height as a number , In both cases, the parent element div Self line-height Are all 32px
边栏推荐
- GoFrame第五天
- V-bind and v-on
- Multi thread implementation of selling tickets and producers and consumers
- try-catch finally执行顺序的例题
- Spark Optimization -- differences and policy selection of RDD cache (cache, persist, checkpoint)
- 单片机:Modbus 通信协议介绍
- Lambda终结操作查找与匹配allMatch
- Lambda end operation collect
- Student management system
- 【测试开发】文件压缩项目实战
猜你喜欢

Alipay open platform

单片机信号发生器程序

大疆无人机飞控系统的原理、组成及各传感器的作用

User and permission configuration in SQL Server database to ensure database security

SQL injection case demonstration and preventive measures

Multi thread writing method and the making of slot machine

What to bring to 2022

MySQL 8.0 enables remote root user access and solves the problem of you are not allowed to create a user with Grant

【多线程】多线程到底是个甚——多线程初阶(复习自用)

EGO Planner代码解析----CMakeLists.txt和package.xml
随机推荐
Goframe day 5
【测试开发】软件测试基础篇
【测试开发】自动化测试selenium(三)——unittest框架解析
Lambda终结操作查找与匹配findFirst
UnionPay commerce - merchant statistics service platform
任总与系统工程领域科学家、专家会谈纪要
[web] cookies and sessions
Determine whether the file encoding format is UTF-8 or GBK
EGO planner论文翻译
单片机:A/D 和 D/A 的基本概念
Window and various windowfunctions in Flink
Oracle built-in functions
[Yugong series] June 2022 Net architecture class 080 master cluster and database switching of distributed middleware schedulemaster
单片机:EEPROM介绍与操作
Among the four common technologies for UAV obstacle avoidance, why does Dajiang prefer binocular vision
Lambda termination operation Max & min
ROS话题与节点
Spark optimization - Performance (general performance, operator, shuffle, JVM) tuning
Lambda终结操作reduce归并
【测试开发】博客系统——Loadrunner性能测试(发布博客功能 基准测试)