当前位置:网站首页>px em rem的区别
px em rem的区别
2022-07-04 05:31:00 【是张鱼小丸子鸭】
目录
px
相对长度单位,相对于显示器屏幕分辨率而言
存在浏览器不兼容问题
em
相对长度单位,相当于当前对象内文本字体尺寸
em值不固定,em会继承父元素的大小
容易造成字体设置混乱问题
如果他父级设置的font-size为10px,那么1em就等于父系的10px,2em就等于父系的20px,以此类推
我们一般不经常使用em,如果父级元素删除了,那么他会去寻找他的父级->父级,所以特别容易造成字体设置混乱问题
Rem
相对长度单位,相对于根节点html字体大小来计算,任意浏览器默认字体高都是16px
如果html根节点设置字体font-size为100px. 则1em=100px. 2em=200px. 跟父级字体无关
浏览器兼容性比较好
边栏推荐
猜你喜欢
![[excel] PivotChart](/img/45/be87e4428a1d8ef66ef34a63d12fd4.png)
[excel] PivotChart

Write a complete answer applet (including single choice questions, judgment questions and multiple topics) (III) single choice questions, judgment questions, and the first question display

数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技

Flask

Kubernets first meeting

HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)

2022年A特种设备相关管理(电梯)考试题模拟考试平台操作

Upper computer software development - log information is stored in the database based on log4net

VB.net GIF(制作、拆解——优化代码,类库——5)

What are the reasons for the frequent high CPU of ECS?
随机推荐
Penetration tool - sqlmap
Arc135 a (time complexity analysis)
How to use postman to realize simple interface Association [add, delete, modify and query]
[QT] timer
C language simple student management system (including source code)
Zzulioj:1201: mode problem
Wechat applet +php realizes authorized login
云原生架构实战案例及优化解决方案
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
2022年R2移动式压力容器充装复训题库及答案
Accidentally deleted the data file of Clickhouse, can it be restored?
BUU-Crypto-[GUET-CTF2019]BabyRSA
Introduction to AMBA
[Excel] 数据透视图
Yyds dry goods inventory TCP & UDP
Notepad++ -- display related configurations
Graduation design of small programs -- small programs of food and recipes
Google Chrome browser will support the function of selecting text translation
KMP match string
SQL injection - injection based on MSSQL (SQL Server)