pixel-ratio

Double-width borders on Android devices with a CSS pixel ratio of 1.5

∥☆過路亽.° 提交于 2019-12-23 09:47:23
问题 Given a simple page (source below) that contains an element with a 1px border, it will render like this on Android compared to iOS: As you can see, the Android border does not have a uniform width, sometimes being 1px and sometimes being 2px wide. As far as I've been able to test it, this only occurs on devices with a CSS pixel ratio of 1.5 (including the Android emulator), but not with a pixel ratio of 2 (including iOS). I believe that this problem is caused by subpixel-antialias and/or

Media queries and device pixel ratio

陌路散爱 提交于 2019-12-23 02:36:31
问题 I'm in the process of redesigning my website and I've decided to take a shot at responsive layout. I'm new to CSS3 media queries and can't figure out how to make the site behave as intended on my smartphone. The page has currently this viewport meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> I'm not sure what it does, as I don't see a difference between having and not having this in my HTML, but was told that it was somehow useful. The style sheets are

How to optimize canvas circle for retina devices?

不打扰是莪最后的温柔 提交于 2019-12-11 10:13:47
问题 Please tell me how to make canvas look sharp for retina devices? I would be grateful if you show in my example - fiddle var canvas = document.getElementById('timer'); var context = canvas.getContext('2d'); var x = canvas.width / 2; var y = canvas.height / 2; var radius = 105; var endPercent = 100; var curPerc = 0; var counterClockwise = false; var circ = Math.PI * 2; var quart = Math.PI / 2; 来源: https://stackoverflow.com/questions/29027477/how-to-optimize-canvas-circle-for-retina-devices

Media queries and device pixel ratio

↘锁芯ラ 提交于 2019-12-08 05:59:27
I'm in the process of redesigning my website and I've decided to take a shot at responsive layout. I'm new to CSS3 media queries and can't figure out how to make the site behave as intended on my smartphone. The page has currently this viewport meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> I'm not sure what it does, as I don't see a difference between having and not having this in my HTML, but was told that it was somehow useful. The style sheets are supposed to target widths R < 640px, 640px <= R < 960px and 960px <= R. The layout will, respectively, be

What are best practices for detecting pixel ratio/density?

99封情书 提交于 2019-11-27 01:32:36
问题 I am currently using JavaScript for mobile device detection on my website, this then allows me to serve different content for mobile or desktop users. Currently I use window.devicePixelRatio and screen.width to work out if the user if on a mobile device or not, like so: var isMobileScreenWidth = ((screen.width / window.devicePixelRatio) < 768) 768px is the point at which we define mobile or desktop so 767 and below is mobile and 768 and above is desktop. This works perfectly, but I have