I wrote simple code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta id="meta" name="viewport" content="width=device-width"> <style> *{ margin:0px; padding:0px; } #div{ height:91px; width:320px; background-color:red; display:inline-block; } body{ background-color:black; text-align:center; } </style> </head> <body> <div id="div">hello</div> </body> </html>
I have a 20 inch monitor, I want to emulate on it, as the iPhone displays. To do this, I go to Devtuls and switch to the phone icon - adaptive layout.
The width of the red square in CSS-pixels is 320. I thought that the width of the iPhone 5 is 640 pixels - “iron” pixels. But it gave out only 320 which pixels it is not clear. What is this number? It turns out that the red square with a width of 320 CSS-pixels is equal to the width of an iPhone 5 with a width of 320 some (ANY - iron pixels, KCC-pixels or dip-pixels?) Pixels. Why is that? I used to work on a 20 inch monitor, and when I write window.screen.width, I get 1600 pixels of iron. But, emulating iPhone 5, I write window.screen.width and get again the same 320 pixels.