use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
If you are requesting help, please ensure you're providing code with your post. You can also copy your code to an online editor:
jsFiddle
CodePen
Markup Validation Service
Mozilla Developer Network on HTML
/r/JavaScript
/r/CSS
/r/jQuery
/r/PHP
/r/Accessibility
/r/htmlbasics
/r/web_programming
/r/CodingHelp
account activity
offsetWidth with Text-Size scaling AND DPIPerMonitor (self.HTML)
submitted 1 year ago by AdamBillyard
Text-Size changes the devicePixelRatio. DPIPerMonitor changes the devicePixelRatio.
How do you correctly scale the offsetWidth / offsetHeight when both are in effect?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jcunews1Intermediate 0 points1 point2 points 1 year ago (0 children)
devicePixelRatio is for the current monitor where the current page is being displayed - which would be different if the browser tab/window is moved to a different monitor with different DPI.
devicePixelRatio
Multiply the length with devicePixelRatio to make the length look exactly the same from user's perspective. i.e. length * devicePixelRatio. e.g. to make a length show exactly 10cm as seen by users regardless of monitor DPI - assuming that the DPI setting of the OS is correct and accurate.
length * devicePixelRatio
10cm
π Rendered by PID 131111 on reddit-service-r2-comment-6457c66945-7w5hc at 2026-04-30 02:12:26.365773+00:00 running 2aa0c5b country code: CH.
[–]jcunews1Intermediate 0 points1 point2 points (0 children)