Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does floating point length value make sense on pixel unit?

Tags:

css

pixel

When I try write stylish CSS for forums.asterisk.org site, I saw they use floating point length value on pixel unit, for example: font-size: 13.1px;.

As far as I known, pixel is the smallest unit in screen, so does floating point length value make sense on pixel unit?

Screenshot

forums.asterisk.org site use floating point length value on pixel unit

like image 356
LiuYan 刘研 Avatar asked Dec 11 '13 07:12

LiuYan 刘研


People also ask

Can pixel values be float?

A Mat can hold float values, as well as many other types. Examples of images having float` values are: BGR images are typically in range 0, 255 for uchar , but in range [0,1] for float . It's just a convention.

How are pixel values calculated?

For example, if you are comparing two pixels (i.e. one pixel in each image), you have a region of 1 pixel. Let's say it is the fifth pixel in the first row: x = 0, y = 4. The pixel values are 10,3 for f,g respectively. For the region of one 2n1=1=>n1=0, and the same goes for n2.


1 Answers

It's fine, the CSS recommendation allows numbers (not only integers) as values for pixels. Note that px is actually defined in terms of in in the recommendation:

‘px’: pixels; 1px is equal to 1/96th of 1in

All in all 13.1px will be the same as 0.1364in, where 13px would be 0.1354in. The difference is small, but noticeable.

That being said, you should use relative values in my opinion instead, and pt for the overall base size.

like image 83
Zeta Avatar answered Sep 20 '22 12:09

Zeta