I've worked as React Native dev for a while, and am kinda new to web dev. Recently came across codebase where people specify sizes in different formats mixed together.
(From what I've read so far, from the accessibility standpoint it's often best to specify font sizes / margins with rem
or em
, but there's a lot of people discussing when to use which.)
But let's just say you want to specify sizes in pixels. There are just 2 ways you can do in "CSS is JS".
With string
fontSize: "15px", lineHeight: "22.5px", marginTop: "20px",
With number
fontSize: 15, lineHeight: 22.5, marginTop: 20,
Is there any difference between the 2? Would love to know if there's any pros and cons. Thanks!
https://stackoverflow.com/questions/65444579/css-in-js-is-there-any-difference-between-18px-vs-18-when-specifying-sizes December 25, 2020 at 09:45AM
没有评论:
发表评论