Please stop using px for font-size.

Please stop using px for font-size.

258.448 Lượt nghe
Please stop using px for font-size.
🔥 Learn how to build a responsive website from a Figma design with HTML, SCSS, JS ➡️ https://coder-coder.com/responsive/ 😎 Join the Coder Coder Club for $5/mth and get sneak peeks of videos: https://courses.coder-coder.com/p/club What CSS unit should you use for font size? In this video, I'll show you why you should not use the px unit for font-size, width, and height of elements. The px unit is not affected by the browser's base font size, and so is not accessible for users who want to increase the font-size by using that browser setting. For accessibility, it's better to use rem or em units 0:00 - Intro 0:23 - The problem with px 3:28 - Don't use px for widths 5:32 - Don't use px in media queries 9:03 - Ways to convert from px to rems 12:20 - What about the 62.5% hack? Resources mentioned in video: 🐙 GitHub repo: https://github.com/thecodercoder/stop-using-pixels 🖥️ MDN notes on pixels and font-size -- https://developer.mozilla.org/en-US/docs/Web/CSS/font-size#pixels ↗️ WCAG Resize Text standards -- https://www.w3.org/WAI/WCAG22/quickref/#resize-text ✒️ Josh Comeau, "The Surprising Truth About Pixels and Accessibility" -- https://www.joshwcomeau.com/css/surprising-truth-about-pixels-and-accessibility/#the-sixtwofive-trick-13 ____________________________ ✉️ Want to get emails about new videos, course sales, and other web dev news? Sign up here: https://coder-coder.com/subscribe/ 👕 Get my hoodie here: https://coder-coder.com/merch 💻 Become a full-stack web dev with Zero to Mastery: https://academy.zerotomastery.io/a/aff_338z7xnj/external?affcode=441520_ti97uk6b 🎨 Get my VS Code theme: https://marketplace.visualstudio.com/items?itemName=CoderCoder.codercoder-dark-theme 🔽 FOLLOW CODER CODER Twitter -- https://twitter.com/thecodercoder Instagram -- https://www.instagram.com/thecodercoder #css #javascript #html