当前位置:网站首页>em与rem的区别
em与rem的区别
2022-07-21 22:37:00 【大象与小蚂蚁的生活】
- px是固定像素,一旦设置了就无法因为适应页面而改变。
- em是rem相对于px更具有灵活性,他们是相对于长度单位的变化而变化,更适应于响应式布局。
em相对于父元素
rem相对于根元素
em的具体解析:
子元素字体大小的em是相对于父元素字体大小
元素的width/height/padding/margin用em的话相对于该元素的font-size。
rem具体解析:
rem是全部的长度都相当于根元素,根元素是谁?元素
通常做法是给html元素设置一个字体大小,然后其他元素的长度单位为rem。
html {
font-size: 10px;
}
边栏推荐
- Format data JSON in pycharm tool
- Analysis on the difference between repayment methods of equal principal and equal principal and interest
- Multiple backpack notes
- 2022大健康产业展,山东大健康展会,健康膳食展,特医食品展
- What are the advantages of WMS warehouse management system based on bar code
- 2022.07.20
- The graduation design of wechat hotel reservation applet (3) background function
- Chrome plug-in development tutorial
- ACL-IJCAI-SIGIR頂級會議論文報告會(AIS 2022)筆記1:推薦系統
- China Economic Net: "Yuan universe" is hot
猜你喜欢
透过Redis源码探究Hash表的实现
Four redis cluster schemes and their advantages and disadvantages
What are the characteristics of ball screen projection with different implementation methods
2022.07.20
2022 音视频技术风向标
【FAQ】应用内支付服务无法拉起支付页面常见原因分析和解决方法
[technology] introduction of uniapp u-charts partial demo
OAuth2.0
华为无线设备配置攻击检测功能
STM32 minimum system design
随机推荐
2022.07.20
How to solve the problem that PIP command display is not internal or external command in Anaconda
点绕网格中心顺时针旋转 90° 180° 270°坐标的变化
C # read and write data to PLC in conjunction with kepserver
Common terms of ad
threejs
Chrome plug-in development tutorial
多重背包笔记
ECCV 2022 | 基于不变特征学习的广义长尾分类
esp8266模拟输入(ADC)检测问题
requests库中使用response.json()报错:json.decoder.JSONDecodeError: Expecting value
2022 great health industry exhibition, Shandong great health exhibition, healthy diet exhibition, special medical food exhibition
小程序毕设作品之微信酒店预订小程序毕业设计(2)小程序功能
How can a technician take over his project when he suddenly leaves?
Multiple backpack notes
[open source serial port visualization tool serial studio]
Serial port based SD_ Card system
B-end product manager learning: data analysis - Zhuge IO, Shence data
【2022国赛模拟】最小生成树——Kruskal、矩阵、树剖动态DP
[建议收藏]缓存雪崩的处理办法