{"course":{"slug":"design-foundations","title":"Design, before Any Software","url":"https://addaly.com/learn/design-foundations","level":"beginner","track":"create"},"lesson":{"slug":"the-numbers-real-devices-have","title":"What a pixel is, and how wide phones actually are","url":"https://addaly.com/learn/design-foundations/the-numbers-real-devices-have","position":57,"of":74,"minutes":9,"answer":"A CSS pixel is an angular reference rather than a physical size, device pixel ratio means raster assets need 2x or 3x export while vectors need none.","keyIdea":"A CSS pixel is an angular reference rather than a physical size, device pixel ratio means raster assets need 2x or 3x export while vectors need none, and 360 CSS pixels is the width to design at because a layout that fits at 393 can still break there."},"body":{"format":"markdown","text":"## A CSS pixel is not a physical thing\n\nThis trips up nearly everybody once. A CSS pixel is a reference unit defined by the angle it subtends at a typical viewing distance, not by a fixed physical size. The specification's nominal value is 1/96 of an inch at arm's length, which is about 0.26 millimetres, but that is the value for a screen viewed at roughly 60 centimetres.\n\nOn a phone held 30 centimetres away, the browser's CSS pixel is physically smaller. An iPhone 15 reports 393 CSS pixels across a screen about 71 millimetres wide, so one CSS pixel is about 0.18 millimetres there. The 44-pixel touch target from the spacing block is therefore about 8 millimetres of glass, not 11.\n\nThis is intentional rather than broken. What matters for perception is angular size (how much of your visual field something occupies) and a phone held closer needs fewer millimetres for the same angle. It does mean that reasoning about pixels as physical distances is unreliable, and that anything with a physical requirement, such as a touch target, should be checked on a device rather than on a ruler.\n\n## Device pixel ratio\n\nThe hardware has more pixels than the CSS layer admits to. Device pixel ratio is the multiplier:\n\n```\niPhone 15        393 CSS px wide,  DPR 3  → 1179 hardware px\nbudget Android   360 CSS px wide,  DPR 2  →  720 hardware px\n1080p laptop    1536 CSS px wide,  DPR 1.25 (Windows at 125% scaling)\nMacBook Pro     1512 CSS px wide,  DPR 2\n```\n\nTwo consequences that decide real work:\n\n**Raster assets need to be exported at 2x or 3x.** A logo displayed at 120 CSS pixels wide needs a 360-pixel file to look sharp on a DPR-3 phone. An image exported at 1x looks soft on almost every modern device.\n\n**Vector assets do not.** An SVG logo or icon is resolution-independent and sharp at any ratio, at a fraction of the file size. This is the single strongest argument for drawing interface graphics as vectors, and Inkscape does it free.\n\n## The widths to design at\n\nMobile viewport widths cluster tightly. 360 and 390 to 393 CSS pixels cover the overwhelming majority of phones in use, and 360 is the safe floor: it is what a great many Android devices in India, Africa and Latin America report.\n\nDesign at **360**. If it works there it works at 393. The reverse is not reliable: a layout that fits at 393 can break at 360, and the break is usually a fixed-width element or a long unbreakable string.\n\nOn desktop the common widths are far more spread out, and the useful number is not the screen width but the content width, which you are choosing anyway: the measure rule from the type block caps a text column at roughly 30 to 34em regardless of how wide the monitor is.\n\n## The 100vh problem\n\nA specific, extremely common bug. `height: 100vh` on a mobile browser refers to the viewport height with the browser's address bar hidden. While the bar is showing, which is most of the time, the visible area is smaller, so the bottom of a supposedly full-height section is cut off, taking the button with it.\n\nThe modern units solve it:\n\n```css\n.hero { min-height: 100svh; }  /* smallest: bars showing */\n.hero { min-height: 100lvh; }  /* largest: bars hidden */\n.hero { min-height: 100dvh; }  /* dynamic: changes as bars move */\n```\n\n`svh` is the safe default for anything that must be fully visible. `dvh` is correct for a full-screen overlay but causes the layout to resize as the user scrolls, which can look unsettled.\n\n## Safe areas\n\nPhones have rounded corners, camera cut-outs and a home indicator bar. The operating system exposes the insets, and a layout that ignores them puts content under the notch or under the swipe bar:\n\n```css\n.footer-bar {\n  padding-bottom: max(16px, env(safe-area-inset-bottom));\n}\n```\n\nThe `max()` means you get your normal padding on devices with no inset and the correct clearance on devices with one.\n\n## Testing honestly\n\nBrowser device emulation is good for layout and useless for two things it appears to test: touch accuracy, and how anything looks in real light. Both need the actual device.\n\nThe cheapest useful test rig is one inexpensive Android phone, bought second-hand, kept on the desk, and used outdoors. It will find contrast failures, target failures and performance problems that no emulator reports, because emulation runs on your fast machine in your dim room with your mouse."},"check":{"question":"A full-screen section is set to height: 100vh with a button at its bottom edge. On desktop it is fine; on phones the button is often cut off. What is the mechanism?","options":[{"text":"The device pixel ratio makes the section render taller in hardware pixels than the CSS height declares, pushing the button past the physical screen edge.","correct":false,"tempting":"Confuses the hardware scaling factor, which affects sharpness rather than layout extent, with the viewport measurement."},{"text":"The safe-area inset at the bottom of the device is overlapping the button, and env(safe-area-inset-bottom) would restore the clearance.","correct":false,"tempting":"Names a real inset that accounts for a few tens of pixels rather than the height of a browser address bar."},{"text":"100vh measures the viewport with the browser bars hidden, so the visible area is smaller whenever the address bar is showing.","correct":true},{"text":"Mobile browsers apply a minimum font size that expands the section's content beyond the declared height, so the button is pushed out of view.","correct":false,"tempting":"Invokes a text-inflation behaviour that affects text sizing rather than the interpretation of the viewport unit."}]},"prev":{"slug":"what-survives-the-shrink","title":"Design it at 390 pixels or find out the hard way","url":"https://addaly.com/learn/design-foundations/what-survives-the-shrink"},"next":{"slug":"breakpoints-from-content","title":"Breakpoints come from the content, not from devices","url":"https://addaly.com/learn/design-foundations/breakpoints-from-content"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'What a pixel is, and how wide phones actually are', in Design, before Any Software. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/design-foundations/the-numbers-real-devices-have (Accessed: 21 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"What a pixel is, and how wide phones actually are","courseTitle":"Design, before Any Software","module":{"index":6,"slug":"real-screens-and-surfaces","title":"Real screens, real thumbs, real paper"},"answer":null,"keyIdea":"A CSS pixel is an angular reference rather than a physical size, device pixel ratio means raster assets need 2x or 3x export while vectors need none, and 360 CSS pixels is the width to design at because a layout that fits at 393 can still break there.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"a-css-pixel-is-not-a-physical-thing","runs":[{"text":"A CSS pixel is not a physical thing"}]},{"t":"p","runs":[{"text":"This trips up nearly everybody once. A CSS pixel is a reference unit defined by the angle it subtends at a typical viewing distance, not by a fixed physical size. The specification’s nominal value is 1/96 of an inch at arm’s length, which is about 0.26 millimetres, but that is the value for a screen viewed at roughly 60 centimetres."}]},{"t":"p","runs":[{"text":"On a phone held 30 centimetres away, the browser’s CSS pixel is physically smaller. An iPhone 15 reports 393 CSS pixels across a screen about 71 millimetres wide, so one CSS pixel is about 0.18 millimetres there. The 44-pixel touch target from the spacing block is therefore about 8 millimetres of glass, not 11."}]},{"t":"p","runs":[{"text":"This is intentional rather than broken. What matters for perception is angular size (how much of your visual field something occupies) and a phone held closer needs fewer millimetres for the same angle. It does mean that reasoning about pixels as physical distances is unreliable, and that anything with a physical requirement, such as a touch target, should be checked on a device rather than on a ruler."}]},{"t":"h2","id":"device-pixel-ratio","runs":[{"text":"Device pixel ratio"}]},{"t":"p","runs":[{"text":"The hardware has more pixels than the CSS layer admits to. Device pixel ratio is the multiplier:"}]},{"t":"code","lang":"","label":"Text","text":"iPhone 15        393 CSS px wide,  DPR 3  → 1179 hardware px\nbudget Android   360 CSS px wide,  DPR 2  →  720 hardware px\n1080p laptop    1536 CSS px wide,  DPR 1.25 (Windows at 125% scaling)\nMacBook Pro     1512 CSS px wide,  DPR 2"},{"t":"p","runs":[{"text":"Two consequences that decide real work:"}]},{"t":"p","runs":[{"text":"Raster assets need to be exported at 2x or 3x.","b":true},{"text":" A logo displayed at 120 CSS pixels wide needs a 360-pixel file to look sharp on a DPR-3 phone. An image exported at 1x looks soft on almost every modern device."}]},{"t":"p","runs":[{"text":"Vector assets do not.","b":true},{"text":" An SVG logo or icon is resolution-independent and sharp at any ratio, at a fraction of the file size. This is the single strongest argument for drawing interface graphics as vectors, and Inkscape does it free."}]},{"t":"h2","id":"the-widths-to-design-at","runs":[{"text":"The widths to design at"}]},{"t":"p","runs":[{"text":"Mobile viewport widths cluster tightly. 360 and 390 to 393 CSS pixels cover the overwhelming majority of phones in use, and 360 is the safe floor: it is what a great many Android devices in India, Africa and Latin America report."}]},{"t":"p","runs":[{"text":"Design at "},{"text":"360","b":true},{"text":". If it works there it works at 393. The reverse is not reliable: a layout that fits at 393 can break at 360, and the break is usually a fixed-width element or a long unbreakable string."}]},{"t":"p","runs":[{"text":"On desktop the common widths are far more spread out, and the useful number is not the screen width but the content width, which you are choosing anyway: the measure rule from the type block caps a text column at roughly 30 to 34em regardless of how wide the monitor is."}]},{"t":"h2","id":"the-100vh-problem","runs":[{"text":"The 100vh problem"}]},{"t":"p","runs":[{"text":"A specific, extremely common bug. "},{"text":"height: 100vh","code":true},{"text":" on a mobile browser refers to the viewport height with the browser’s address bar hidden. While the bar is showing, which is most of the time, the visible area is smaller, so the bottom of a supposedly full-height section is cut off, taking the button with it."}]},{"t":"p","runs":[{"text":"The modern units solve it:"}]},{"t":"code","lang":"css","label":"CSS","text":".hero { min-height: 100svh; }  /* smallest: bars showing */\n.hero { min-height: 100lvh; }  /* largest: bars hidden */\n.hero { min-height: 100dvh; }  /* dynamic: changes as bars move */"},{"t":"p","runs":[{"text":"svh","code":true},{"text":" is the safe default for anything that must be fully visible. "},{"text":"dvh","code":true},{"text":" is correct for a full-screen overlay but causes the layout to resize as the user scrolls, which can look unsettled."}]},{"t":"h2","id":"safe-areas","runs":[{"text":"Safe areas"}]},{"t":"p","runs":[{"text":"Phones have rounded corners, camera cut-outs and a home indicator bar. The operating system exposes the insets, and a layout that ignores them puts content under the notch or under the swipe bar:"}]},{"t":"code","lang":"css","label":"CSS","text":".footer-bar {\n  padding-bottom: max(16px, env(safe-area-inset-bottom));\n}"},{"t":"p","runs":[{"text":"The "},{"text":"max()","code":true},{"text":" means you get your normal padding on devices with no inset and the correct clearance on devices with one."}]},{"t":"h2","id":"testing-honestly","runs":[{"text":"Testing honestly"}]},{"t":"p","runs":[{"text":"Browser device emulation is good for layout and useless for two things it appears to test: touch accuracy, and how anything looks in real light. Both need the actual device."}]},{"t":"p","runs":[{"text":"The cheapest useful test rig is one inexpensive Android phone, bought second-hand, kept on the desk, and used outdoors. It will find contrast failures, target failures and performance problems that no emulator reports, because emulation runs on your fast machine in your dim room with your mouse."}]}],"check":{"question":[{"text":"A full-screen section is set to height: 100vh with a button at its bottom edge. On desktop it is fine; on phones the button is often cut off. What is the mechanism?"}],"options":[{"text":[{"text":"The device pixel ratio makes the section render taller in hardware pixels than the CSS height declares, pushing the button past the physical screen edge."}],"correct":false,"tempting":[{"text":"Confuses the hardware scaling factor, which affects sharpness rather than layout extent, with the viewport measurement."}]},{"text":[{"text":"The safe-area inset at the bottom of the device is overlapping the button, and env(safe-area-inset-bottom) would restore the clearance."}],"correct":false,"tempting":[{"text":"Names a real inset that accounts for a few tens of pixels rather than the height of a browser address bar."}]},{"text":[{"text":"100vh measures the viewport with the browser bars hidden, so the visible area is smaller whenever the address bar is showing."}],"correct":true,"tempting":null},{"text":[{"text":"Mobile browsers apply a minimum font size that expands the section’s content beyond the declared height, so the button is pushed out of view."}],"correct":false,"tempting":[{"text":"Invokes a text-inflation behaviour that affects text sizing rather than the interpretation of the viewport unit."}]}],"order":[0,2,3,1],"why":null},"prev":{"slug":"what-survives-the-shrink","title":"Design it at 390 pixels or find out the hard way","minutes":9},"next":{"slug":"breakpoints-from-content","title":"Breakpoints come from the content, not from devices","minutes":8}}}