html - Understanding Screen Sizes/Pixel Density for Web Development (Websites & Emails) -


i'm trying understand few things deal pixels.

the first of changes between developing html email , website in terms of appearing on mobile screen. more specific, when developing website, can have media queries run below 375px (i.e. @medie screen , (max-width 375px)) , changes occurring in code not reflected on desktop (since browsers without going inspect restrict width @ 400px); however, on phone has smaller screen iphone se, changes occur under media query hit.

so on own makes sense me, because phone screen smaller min browser width, of course changes apply in block hit when website executed on phone. confusion gets introduced. when developing html email, have table set 600px wide. there no media query affecting html. table 600px wide under circumstances, when displaying on less 600px wide phone, assume of page clipped, not so. when viewing email in gmail, entire composition visible. made me scratch head bit, researched , found sources claiming phone greater 600px wide. thought screen density greater of laptop, or maybe magic gmail applying, either way, email shows on laptop in browser width greater 600px.

i'm using these meta tags

<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 

and have base understanding of do, how these contribute mobile exactly?

in summary, main questions follows:

  • why media queries websites run max-width: 375px hit phone, , yet table 600px wide viewable same time?

  • is matter of screen pixel density, or little more complex?

  • what roles these meta tags play exactly?

any insight can provide appreciated. thank you.

why media queries websites run max-width: 375px hit phone, , yet table 600px wide viewable same time?

because phone visual port has width of 1136 pixels , height of 640 pixels.

is matter of screen pixel density, or little more complex?

its matter of screen pixel density, default pixel ratio depends on display density:

default ratio when viewport scale equals 1 display density < 200dpi ratio = 1.0 display density > 200dpi && display density < 300dpi ratio = 1.5 display density > 300dpi ratio = integer floor(density/150dpi) 

for iphone se 326 ppi (pixel per inch).

what roles these meta tags play exactly?

the tag not part of web standard , introduced mobile safari, width property controls size of viewport, device-width special value, typical use of tag:

<meta name="viewport" content="width=device-width, initial-scale=1"> 

which sets width width of device viewport, , zoom of 1, width in css pixels doesnt take account pixel density @ all. changing value of meta tag javascript works, website react new value. try setting width 375px see happens in phone.

check 2 articles:


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -