CSS Font Size .5 Increments

2019-02-27 20:26发布

问题:

In CSS are you allowed to use .5 increments i.e

font-size: 8.5pt;

Can't see the difference between font-size: 8pt and font-size: 8.5pt

回答1:

Point values are really only for print CSS.

Quoting Chris C:

A point is a unit of measurement used for real-life ink-on-paper typography. 72pts = one inch. One inch = one real-life inch like-on-a-ruler. Not an inch on a screen, which is totally arbitrary based on resolution.

Source: http://css-tricks.com/css-font-size/

The W3C Tips page suggest avoiding them for screen:

The so-called absolute units (cm, mm, in, pt and pc) mean the same in CSS as everywhere else. A length expressed in any of these will appear as exactly that size (within the precision of the hardware and software). They are not recommended for use on screen, because screen sizes vary so much. A big screen may be 60cm (24in), a small, portable screen is maybe only 8cm. And you don't look at them from the same distance.

Source: http://www.w3.org/Style/Examples/007/units.en.html



回答2:

A half point is a very small amount. Without zooming your screen, you likely will never see the difference. Nonetheless, the software IS calculating it and displaying it as best as your resolution allows.



回答3:

When you do a .5 increment while using pt. that may or may not be big enough for the browser to render larger. And then every browser renders text slightly different.