This is consistent with the CSS 2. If the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. It is recommended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel.
It is recommended that the reference pixel be the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For web developers, this means that the size of a page is much smaller than the actual pixel count and browsers may size their layouts and images accordingly.
But remember that not all mobile devices are the same width; you should make sure that your pages work well in a large variation of screen sizes and orientations. The default pixel ratio depends on the display density. On a display with density less than dpi, the ratio is 1. On displays with density between and dpi, the ratio is 1. Note that the default ratio is true only when the viewport scale equals 1.
Otherwise, the relationship between CSS pixels and device pixels depends on the current zoom level. Sites can set their viewport to a specific size. This can cause problems when the browser doesn't render a page at a larger size. You can add it to a page's header and in many cases it'll look way better on mobile even without specific CSS targeting mobile.
The default viewport size of the original iPhone was in place to let it use the "normal" web. At the iPhone's introduction this was a big deal because other smartphone browsers worked best with simple "mobile" layouts. Safari on the iPhone rendered web pages as they looked on the desktop. Making the viewport sized to the display usually makes it so a user doesn't need to zoom in to read text or horizontally scroll to read wonder content.
Collectives on Stack Overflow. Learn more. Site's body and elements are stuck on px width, won't scale down Ask Question. Asked 5 years, 9 months ago. Active 5 years, 9 months ago. Viewed 6k times.
Virge Assault Virge Assault 1, 6 6 gold badges 15 15 silver badges 33 33 bronze badges. Can you make a js fiddle with an image so we can better see what the problem is? Add a comment. Active Oldest Votes. Please see bottom of code snippet for more. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Does the px screen width rule still stand? Ask Question.
Asked 2 years, 5 months ago. Active 2 years, 5 months ago. Viewed 1k times. Improve this question. Lynob Lynob 1 1 silver badge 10 10 bronze badges. I will say is the minimum and an ideal one to cover all types. Naturally the image quality should be lowered for large images to keep the file size under control. It also depends on the image - an image of clouds will look alright even after slight stretch, but a daylight cityscape with sharp edges of the buildings will show pixelation very easily.
Add a comment. Active Oldest Votes.
0コメント