0

Can you make sass breakpoint, when using ems for media queries, be based on your base font size, not the browsers default font size?

Mark Weston
  • 217
  • 3
  • 10

1 Answers1

1

No it does not. Media queries written in em units are always based on the browser's default font size, not on your root font size.

We had toyed with conversion in, but between varying contexts on a per-selector basis, incompatibility with other Compass extensions (including core Compass media queries and the Compass Core vertical rhythm mixin), and the bad mental model it puts people in (thinking in one scale while printing another scale becomes very hard to debug), we decided not to include it and not support it in the future.

What I would suggest if you don't like switching the context in your head while writing em based media queries is to write them in px and then set $breakpoint-to-ems: true and it will automatically do the conversion at the end. It is because em based media queries are always based on the browser's default font size that we're able to do this.

Snugug
  • 2,358
  • 1
  • 16
  • 18
  • Of course, the other option is to just leave the font-size alone. While the average user doesn't know how to modify their browser's default font-size, those that do will thank you. – cimmanon Sep 04 '13 at 17:14
  • Thanks @Snugug I'm glad you replied. I was reading some issues which are around a year old, you were dealing with those, so your answer makes sense. I actually did what you have recommended earlier today and set breakpoint to convert my media queries to ems. Cheers. – Mark Weston Sep 04 '13 at 20:11