An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
April 1, 2022 04:37 am GMT
Original Link: https://dev.to/hyunjin/march-21-2022-5aj0
March 21, 2022
absolute vs relative
absolute - px
relative - %, v*, em, rem
(16px is the pixel that the browser provides default)
em
1em = 16px
for example,
parent > child
.parent{
font-size: 8em;
}
.child{
font-size: 0.5em;
}
parent font size - 16px * 8 = 128px
child font size - 128px(parent font size) * 0.5 = 64px
rem
root em
root = html
parent > child
.parent{
font-size: 8rem;
}
.child{
font-size: 0.5rem;
}
parent font size - 16px * 8 = 128px
child font size - 16px * 0.5 = 8px
Original Link: https://dev.to/hyunjin/march-21-2022-5aj0
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To