While designing with CSS, is it better to use px or the size in words... e.g.. font-size: large OR font-size: 20px? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

While designing with CSS, is it better to use px or the size in words... e.g.. font-size: large OR font-size: 20px?

I actually want to know the safest to use since my code will be displayed on different browsers and different devices.

16th Feb 2019, 6:20 PM
Frankie
Frankie - avatar
5 Answers
+ 9
I feel better😙
16th Feb 2019, 10:51 PM
Frankie
Frankie - avatar
+ 9
Noted. Thanks man John Nehry C. Dedoro
17th Feb 2019, 9:10 PM
Frankie
Frankie - avatar
+ 3
I think you should use font-size:20px or 20% ..large doesn't specify the size..is 100% large or 20% large...so the px and % should be the best
16th Feb 2019, 10:28 PM
Nneka Uchechukwu
+ 2
you can use rem or em units in Css if you want the fonts resizable , the font will be depend on the parent font size.
17th Feb 2019, 7:04 AM
John Nehry C. Dedoro
John Nehry C. Dedoro - avatar
+ 2
I was just going over my profile and came across this question I asked when I was new to css. I'm really glorified to say I can answer this question better now without much stress... Px is for pixels obviously, but with my my experience now, I wouldn't advice this unit when sizing boxes in CSS. % has and advantage of "fluidity" & "adaptivity" of box elements... This fluidity makes the box resizable and somewhat responsive whenever you adjust the screen size of the browser. Although, you can always use @media to make your styling responsive using px. But all round I prefer %. No reference is this post... just what I discovered over the month of constant learning.
8th Sep 2019, 9:42 AM
Frankie
Frankie - avatar