0

I am following Material design specs and all text size values are represented in sp.

E.g. Subheader font: Roboto Medium 14sp

How do I set it in css?

user2814599
  • 1,060
  • 1
  • 13
  • 27
  • Recommend that you read the answers to this question: http://stackoverflow.com/questions/2069810/how-to-assign-text-size-in-sp-value-using-java-code – Bob Dill Dec 22 '15 at 21:52
  • Seems to be Android specific? – user2814599 Dec 22 '15 at 21:55
  • SP refers to scaled pixels, something you run into on most of the current mobile devices. You can try to get away from pixel-based font specifications by using CSS – Bob Dill Dec 22 '15 at 21:58

1 Answers1

1

SP refers to scaled pixels, something you run into on most current mobile devices today. You can move away from pixel notation by using CSS "em" notation, which specifies text sizes where 1 em is equivalent to 16 pixels. So 14 pixels would be 0.875em.

Bob Dill
  • 1,000
  • 5
  • 13
  • I have an idea to use rem. Would it be same as 14sp if I use 1.4rem? (Assuming that the base font size is set to 62.5%) – user2814599 Dec 22 '15 at 22:03
  • Sure, that avoids the compounding effect of elements within elements yielding undesired net font sizes. rem specifies that your element will use the document root font size as the reference point and will simplify your life. That's an effective choice. – Bob Dill Dec 22 '15 at 22:19