RE: Reliable screen size detection audiopro (Programmer) Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown. Ignorance is not necessarily Bliss, case in point: General sizing definitions that should work through most target sizes without needing to know exactly how big the screen is. I.e whether a screen is 300px wide or 200px wide, the general layout should apply to both, and adjust content sizes to fit the slightly smaller ones dynamically.
At the end of they day, your CSS should be able to resize images and sections when space is reduced based on more general media queries. This means coding dynamically, and using as few fixed widths as is possible.Īs Borvik points out you can use media queries to adjust things for more specific screen dimension ranges, not really specific sizes. Your HTML and CSS should be designed such that they can adapt to whatever screen size they are in. In my experience, there's no way to reliably know the screen dimensions of a device, and no real need to do so either. RE: Reliable screen size detection Borvik (Programmer) 6 Apr 16 14:22
CSS FOR DIFFERENT SCREEN SIZES CODE
The best way is making it a users choice to zoom as he needs/wants and maybe offer different views with more and less detail, so the adaptation is half automatic, still convenient enough to the user to not depend on the intelligence of code and exactness of CSS implementation. You can more and more rely on what HTML5/CSS3 gives you is the truth about the devices and stop supporting older devices, browsers, and older HMTL/CSS standards. So it's not even only a problem of knowing physical dimensions and I see no real solution for that matter.
CSS FOR DIFFERENT SCREEN SIZES TV
On a very large screen you can assume your app runs on a tv and should render text much bigger in pixel AND physical size, then on a smartphone a user has within hand reach. The other thing you'll even not know and only can deduce from the ppi (pixel density) is how far off the display the user is. The typical viewport definition you do is and you still don't know anything about the pixel size. It's surely a client side thing and thus you only find solutions in client side code, html, css and javascript. One problem is, even if you know the number pixels you still don't know the size in inch/mm. If at all, it would have been defined, implemented, but not discovered.