---
title: "Discussion on \"🛑 Stop using pixels in CSS\" | Hashnode"
description: "Discussion on \"🛑 Stop using pixels in CSS\". I may be the worst advocate for actually doing this, but let me try and be a better person from now on.\nAnd please, you too!\nLet's all get away from pixels\nBut, don't take just my word for it:\nhttps://twitter.com/idoshamun/status/1300690100741967877?..."
url: "https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [🛑 Stop using pixels in CSS](https://h.daily-dev-tips.com/stop-using-pixels-in-css?utm_source=hashnode&utm_medium=feed)

I may be the worst advocate for actually doing this, but let me try and be a better person from now on. And please, you too! Let's all get away from pixels But, don't take just my word for it: https://twitter.com/idoshamun/status/1300690100741967877?...

Sep 12, 2020 · 2 min read · h.daily-dev-tips.com  
Read the article

-   [#css](https://hashnode.com/tag/css)
-   [#css3](https://hashnode.com/tag/css3)
-   [#accessibility](https://hashnode.com/tag/accessibility)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#web-accessibility](https://hashnode.com/tag/web-accessibility)

## Written by

[Chris Bongers](https://hashnode.com/@dailydevtips)

@dailydevtips · Cape Town, SA

  
[View profile](https://hashnode.com/@dailydevtips)

Looking to get into development? As a full-stack developer I guide you on this journey and give you bite sized tips every single day 👊

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.

## Responses 4

Markdown supported · ⌘↵ to post

[Chris Short](https://hashnode.com/@devcshort)

[Sep 15, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f60e169c417c20b18b7219c)

Should we also be using **_rems_** for margins, borders, padding, and basically everything else as well? Or just for font size?

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Sep 15, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f60e169c417c20b18b7219c#reply-5f61051bc417c20b18b72322)

I use it for font-size/margin

But for borders/border-radius and media-queries I still use pixels.

I'm actually not 100% sure on the "best" answer, but this is my gut feeling and it works well.

[Chris Short](https://hashnode.com/@devcshort)

[Sep 16, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f60e169c417c20b18b7219c#reply-5f6232fb018bef1561b42a0d)

[Chris Bongers](https://hashnode.com/@dailydevtips) I was thinking the same thing. Border radius would probably give some wacky results if using rems. And media queries probably wouldn't work very well either. Thanks for the response :)

[Dharmen Shah](https://hashnode.com/@shhdharmen)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5d275eddc3fe5f4f24d4d3)

Great article... 👍

I would also suggest everyone to check Responsive Font Size (a.k.a. RFS). It's a unit resizing engine which resizes fonts (and more) based on viewport width. Bootstrap also provides an option to [enable it](https://getbootstrap.com/docs/4.5/content/typography/#responsive-font-sizes).

[https://github.com/twbs/rfs](https://github.com/twbs/rfs)

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Sep 13, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5d275eddc3fe5f4f24d4d3#reply-5f5ddf6013599a5f2e33fb10)

Awesome, that's some cool stuff!

[Prateek Aher](https://hashnode.com/@prateek_aher)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c7b77ddc3fe5f4f24ccda)

I don't understand. If _rem_ is directly proportional to _px_, what advantage does it possibly hold? I've been using _px_ only for borders and _%, vw & vh_ for the rest.

[Peter Thaleikis](https://hashnode.com/@spekulatius)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c7b77ddc3fe5f4f24ccda#reply-5f5cca8813599a5f2e33f47b)

Yeah, it's the zooming (manually or by default) which wouldn't change using px values.

[Mark](https://hashnode.com/@mverleg)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c7b77ddc3fe5f4f24ccda#reply-5f5cd2cb13599a5f2e33f4ce)

> if rem is directly proportional to px, what advantage does it possibly hold

The answer is that it isn't directly proportional. It depends on the font size. The formulas and converter work under the assumption of default font size.

It's like those measuring cups that have kg and liters, do you have one in your kitchen? They only measure liters, so the kg is a misleading lie. But because most kitchen-liquids have density close to that of water, it's a sort-of-useful trick anyway.

Same with rem and px: most users will be using 16px = 1rem so it's a good starting point, but the whole reason rem is better is because sometimes 1rem != 16px.

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Sep 13, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c7b77ddc3fe5f4f24ccda#reply-5f5ddf3c13599a5f2e33fb07)

[Mark](https://hashnode.com/@mverleg) Exactly is based on the root font-size (HTML) so hence I included that in my calculator.

You must keep in mind screenreaders and some mobile devices have a bigger font-size by default.

People could also use accessibility tools that don't necessary use the zoom function.

[Rahul](https://hashnode.com/@RAHULISM)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c6126ddc3fe5f4f24cbdb)

Amazing Post on CSS. Purely loved it. bookmarked. I just love to read short, cool and informative posts. Nice one. 🤘👍

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c6126ddc3fe5f4f24cbdb#reply-5f5c6250ddc3fe5f4f24cbfc)

Wow, thank you Rahul, means a lot to me. Especially coming from you. 🤟

[Rahul](https://hashnode.com/@RAHULISM)

[Sep 12, 2020](https://hashnode.com/posts/stop-using-pixels-in-css/5f5c5f0eddc3fe5f4f24cbbb/comment/5f5c6126ddc3fe5f4f24cbdb#reply-5f5c62f0ddc3fe5f4f24cc02)

[Chris Bongers](https://hashnode.com/@dailydevtips) Haha.
