question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Defining the font size in diffent units than 'px'

See original GitHub issue

Currently, the defult unit in Chart.js is ‘px’, and if I set ‘rem’ after a value in both defaultFontSize or fontSize (inside options), no text appears.

I would like to know if it is possible to change the default unit (px) to another (rem, in my case).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JohnArchercommented, Jan 30, 2020

Any chance that this will be implemented (in v3)? I need the same (pt in my case).

0reactions
MichaelBraunercommented, Jul 6, 2021

I use this function to scale my font size down, when on mobile:

static getRelationalFontSize(mobileBreakpoint = 1920, baseFontSize = 28) {

    return window.innerWidth <= mobileBreakpoint
      ? baseFontSize * window.innerWidth / mobileBreakpoint
      : baseFontSize

  }

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS: em, px, pt, cm, in… - W3C
The em and ex units depend on the font and may be different for each element in the document. The em is simply...
Read more >
font-size - CSS: Cascading Style Sheets - MDN Web Docs
The font-size CSS property sets the size of the font. Changing the font size also updates the sizes of the font size-relative <length>...
Read more >
Font Sizes in Responsive Design: px vs. pt vs. em vs. percent?
Points (pt) as CSS font size. Points are a unit of measurement used in print. Points are based on an inch on a...
Read more >
Font size conversion px-pt-em-rem-percent - webSemantics
An online tool to freely convert between pixels, points, rems (ems), and percent values. Primarily for font-sizes and media queries.
Read more >
Font Size Units in Responsive Web Design - LinkedIn
There are four different font size units: pixels, points, ems and percents. However, which unit is best suited for the web?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found