10.5px or 11.5px Font Size?

Harry P

Well-known member
Registered
Joined
Feb 3, 2015
Messages
447
Points
28
How my text can use font size 10.5px or 11.5px, I tried this css: font-size: 11.5px; but it seems converting to 11px or 12 px. Is there a way to exactly archive 10.5px or 11.5px font size on my website?
 

m19

Member
Hosting Provider
Registered
Joined
Jun 16, 2017
Messages
47
Points
8
You can't divide a pixel (px) into further fractions as it's a single unit of color, or a dot on your screen.

When you set the font size to 10.5px, that .5 will either need to be displayed as an entire pixel or not at all. So it's displayed as 11px.
 

Harry P

Well-known member
Registered
Joined
Feb 3, 2015
Messages
447
Points
28
Harry P
I search and some said I can use rem or em unit

for example, 1rem = 16px. so 10.5px = 0.65625rem.

but I have not tried this way yet. I don't know how to compare font size.
 

m19

Member
Hosting Provider
Registered
Joined
Jun 16, 2017
Messages
47
Points
8
m19
Yes you can use rem or em to specify font sizes. But no matter what unit you use, it's not physically possible to display 10.5px on a screen.

As I said before, a pixel is a single dot on your screen. If you look close enough you might be able to see the individual pixels on your own monitor. And each one of these pixels can only display a single solid color.

To make it easier for you to understand, let's say you drew a black colored straight line on a white background which is 1px wide and 100px long. If you divide the width of the line by 2, you should in theory have a line which is 0.5px wide. But as a pixel is literally a single dot on your screen and cannot display more than 1 color, it can only display either the white background or the black line.

So in your case, the browser will round off 10.5px to 11px and display the font.

I would suggest trying out different fonts until you get the right look.
 
Newer Threads
Latest Threads
Replies
0
Views
24
Replies
0
Views
70
Replies
1
Views
223
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top