px vs rem: what to use for font-size in your CSS
Skills:
HTML & CSS80%
๐ฅ My course: Responsive Design for Beginners! https://coder-coder.com/responsive/
๐ป Become a full-stack web dev with Zero to Mastery: https://academy.zerotomastery.io/a/aff_338z7xnj/external?affcode=441520_ti97uk6b
In this video I talk about why I use the rem unit instead of px (pixels) for font-size in my CSS styles. And I show you how I use rems and convert them to px in my Sass/SCSS workflow!
0:00 - intro
0:48 - how to change base font size in the browser
1:45 - font-size computed with rem units is accessible
3:32 - using px for font-size is not accessible
5:09 - why not just use zoom?
6:24 - absolute and relative units in CSS
7:22 - how em differs from rem
11:21 - the 62.5% hack for easier px to rem conversion
13:32 - I use a Sass function to convert instead
____________________________
SUPPORT THE CHANNEL
โญ Join channel members and get perks: https://www.youtube.com/channel/UCzNf0liwUzMN6_pixbQlMhQ/join
๐๐ฝ Hit the THANKS button in any video!
๐จ Get my VS Code theme: https://marketplace.visualstudio.com/items?itemName=CoderCoder.codercoder-dark-theme
WANT TO LEARN WEB DEV?
Check out my courses:
๐ Responsive Design for Beginners: https://coder-coder.com/responsive/
๐ Gulp for Beginners: https://coder-coder.com/gulp-course/
RECOMMENDATIONS
โจ My keyboard-- get 10% off with code THECODERCODER -- https://vissles.com/?ref=mu96kxst5w
๐ป Other gear -- https://www.amazon.com/shop/thecodercoder?listId=1LMCKGUTMVYXD
๐ My Favorite Books -- https://coder-coder.com/best-web-development-books/
๐บ My Favorite Courses -- https://coder-coder.com/best-web-development-courses/
๐ฝ FOLLOW CODER CODER
Blog -- https://coder-coder.com/
Twitter -- https://twitter.com/thecodercoder
Instagram -- https://www.instagram.com/thecodercoder
#webdevelopment #coding #programming
Watch on YouTube โ
(saves to browser)
Sign in to unlock AI tutor explanation ยท โก30
Playlist
Uploads from Coder Coder ยท Coder Coder ยท 0 of 60
โ Previous
Next โ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
How to Make a Super Simple HTML Website [Tutorial]
Coder Coder
How to make an animated sticky header with CSS and JavaScript!
Coder Coder
How to get coding help by researching online
Coder Coder
IG Live - Advice for beginner web developers
Coder Coder
Quick Start Guide to Parcel JS
Coder Coder
Build a responsive website with HTML & CSS - Part 1 [Live Coding]
Coder Coder
Build a custom Linktree page for Instagram with HTML & CSS
Coder Coder
Gulp 4 Crash Course for Beginners
Coder Coder
How to use CSS position to layout a website
Coder Coder
CSS: 4 Reasons Your Z-Index Isn't Working
Coder Coder
Coding a landing page website with HTML & CSS
Coder Coder
Learn web development as an absolute beginner
Coder Coder
How to write media queries in CSS
Coder Coder
How to build a 2-column layout using flexbox | HTML/CSS
Coder Coder
How to build a simple responsive layout with CSS grid
Coder Coder
Write code faster in VS Code with Emmet shortcuts
Coder Coder
How I setup VS Code for a beginners front-end workflow
Coder Coder
How to make a background-image transparent in CSS
Coder Coder
Build a responsive website from scratch with HTML & CSS | Part 1: Navigation bar
Coder Coder
Animated Hamburger Menu in CSS/JS | Build a responsive website from scratch (Part 2)
Coder Coder
Animated mobile menu with CSS/JS | Build a responsive website from scratch (Part 3)
Coder Coder
How to stay motivated when learning to code?
Coder Coder
Responsive hero | Build a responsive website from scratch (Part 4)
Coder Coder
Responsive 4-column layout with flexbox | Build a responsive website from scratch (Part 5)
Coder Coder
Responsive 4-column layout with CSS Grid | Build a responsive website from scratch (Part 6)
Coder Coder
Building a footer using CSS Grid | Build a responsive website from scratch (Part 7)
Coder Coder
Browsersync + Sass + Gulp in 15 minutes
Coder Coder
Responsive card UI with flexbox and hover effects | HTML/CSS
Coder Coder
CSS grid cards with animated hover effect | HTML/CSS
Coder Coder
How I learned to code and landed a job (no CS degree!)
Coder Coder
Building the website for my course (coding timelapse)
Coder Coder
How to debug your code faster ๐ฅ
Coder Coder
Full timelapse + walkthrough of building my website
Coder Coder
Your questions answered!! โจ100K Q&Aโจ
Coder Coder
Building a pricing block with HTML & PuRe CSS
Coder Coder
Use the Google Maps API to build a custom map with markers
Coder Coder
Building an accordion with HTML, CSS & JS (Part 1)
Coder Coder
How to make your own VS Code theme!
Coder Coder
How to build an accordion with HTML, CSS, and JavaScript (Part 2)
Coder Coder
Life/channel update
Coder Coder
Building a Light/Dark Dashboard, Part 1
Coder Coder
What is NPM, and why do we need it? | Tutorial for beginners
Coder Coder
Building a Node.js app (as a JavaScript noob) | ๐ด LIVE CODING
Coder Coder
Free website project ideas for your portfolio #shorts
Coder Coder
How to add quickly emojis on Windows #shorts
Coder Coder
Building a Light/Dark Dashboard, Part 2
Coder Coder
Learn to code with these 4 free resources! #shorts
Coder Coder
Learn flexbox with these 4 resources! #shorts
Coder Coder
[Typing sound] Comparing mechanical vs regular keyboard
Coder Coder
Building a Light/Dark Dashboard, Part 3
Coder Coder
what making web development tutorials is really like ๐
#shorts
Coder Coder
Generate website starter files with just one command!
Coder Coder
emojis in code
Coder Coder
Stay motivated when coding: don't compare yourself with others #shorts
Coder Coder
Building a Light/Dark Dashboard, Part 4
Coder Coder
Coding motivation: slow and steady wins the race ๐ข๐
Coder Coder
Sass @import is being replaced with @use and @forward
Coder Coder
Coding motivation tip: keep your goal in mind
Coder Coder
How do websites work?
Coder Coder
Building a Light/Dark Dashboard, Part 5
Coder Coder
More on: HTML & CSS
View skill โRelated AI Lessons
โก
โก
โก
โก
Next.js vs Vite in 2026: What you should actually use
Dev.to AI
Authentication on the Frontend - More Than Just Tokens
Medium ยท JavaScript
Learn to Build Your First Countdown Timer with HTML, CSS & JavaScript (Perfect for Beginners)
Medium ยท JavaScript
Slice.js 3.0: Simple, Powerful, Vanilla Web Apps
Medium ยท JavaScript
Chapters (9)
intro
0:48
how to change base font size in the browser
1:45
font-size computed with rem units is accessible
3:32
using px for font-size is not accessible
5:09
why not just use zoom?
6:24
absolute and relative units in CSS
7:22
how em differs from rem
11:21
the 62.5% hack for easier px to rem conversion
13:32
I use a Sass function to convert instead
๐
Tutor Explanation
DeepCamp AI