benstpierre
benstpierre

Reputation: 33581

Decimal precision positioning in browser

Is it possible to position elements with sub-pixel positioning?

Our application builds a web-preview of PDFs but because the browser will not let us position things with fractional positions/dimensions there are rounding errors causing the web preview to look different than the PDF.

Any ideas?

Upvotes: 2

Views: 351

Answers (2)

JMichelB
JMichelB

Reputation: 475

You could try using relative units, like Percents and Em. Pixel positionning can be tricky if you don't have the same resolution as the client, and it can't have fractionnal values.

Upvotes: 0

Chris Laplante
Chris Laplante

Reputation: 29658

"Sub-pixel" support is certainly not consistent across all browsers. I personally wouldn't trust it.

I'd recommend this resource: http://elasticss.com/determination-of-algorithms-used-for-percentage-based-rounding-divs-on-browsers-and-css-frameworks/

Upvotes: 1

Related Questions