Snippet

Convert dp to pt then rem

AOAnonymous One· Sep 1, 20221 min read
  • #CSS
  • #SCSS
  • #Sass

Convert dp to pt then rem

SCSS function to convert Density-independent Pixels(dp) to Points(pt) then to The root elements font-size(rem).

Filename: some-file.scss

/* Formula to convert dp to pt and then rem
*  pt = (72/160)*dp
*/ rem = pt * 0.083333396325467

@function dp2Rem($_dp) {
  @return ((72 / 160) * $_dp) * 0.083333396325467 + rem;
}

0 Comments

Sign in to join the conversation.

Search

Jump to a page, story or project