当前位置:网站首页>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. 跟父级字体无关
浏览器兼容性比较好
边栏推荐
- 接地继电器DD-1/60
- Principle and practice of common defects in RSA encryption application
- Signification des lettres du module optique et abréviation des paramètres Daquan
- Analysis of classical pointer and array written test questions in C language
- Leetcode 184 Employees with the highest wages in the Department (July 3, 2022)
- 拓扑排序和关键路径的图形化显示
- BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
- left_ and_ right_ Net interpretable design
- Simulated small root pile
- What is MQ?
猜你喜欢
补某视频网站的js,进行视频解密
input显示当前选择的图片
Letter meaning and parameter abbreviation of optical module Daquan
【QT】制作MyComboBox点击事件
Input displays the currently selected picture
2022年R2移动式压力容器充装复训题库及答案
Steady! Huawei micro certification Huawei cloud computing service practice is stable!
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
How to use postman to realize simple interface Association [add, delete, modify and query]
RSA加密应用常见缺陷的原理与实践
随机推荐
js如何将秒转换成时分秒显示
724. Find the central subscript of the array
Supplement the JS of a video website to decrypt the video
检漏继电器JY82-2P
left_ and_ right_ Net interpretable design
1480. 一维数组的动态和
基于单片机的太阳能杀虫系统
Thread pool: use thread pool to optimize query speed
2022g2 power station boiler stoker special operation certificate examination question bank and answers
LC周赛300
input显示当前选择的图片
Void convolution, deformable convolution, deformable ROI pooling
Input displays the currently selected picture
flink1.13 sql基础语法(一)DDL、DML
2022 question bank and answers for safety management personnel of hazardous chemical business units
补某视频网站的js,进行视频解密
JS string splicing
Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
VB. Net simple processing pictures, black and white (class library - 7)
C language simple student management system (including source code)