javascript - How can I scale media queries? -


ahoy...

i'm doing ember application, , need able scale layout, needs displayed on large panels, can't pixel ratio. (oh, and way down iphone screens well...)

so, here's problem: i've made whole thing totally scalable , dandy, do need use bunch of media queries here , there.

now, while can scale application (fonts etc.) , down js skillz, general layout remains same, media queries unchanged. makes distorted.

what need able apply scaling factor limits in media queries.

i realise workaround change meta tag screen width, that's no-go, need device pixel = actual pixel cleanest rendering (many androids fuzzy pixel ratio e.g. 1.75).

i've looked @ using calc(..) in media queries (doesn't work). i'm using ember, have access templates , stuff. i'm thinking along lines of calculating in js , shoving dom in style tag, ~100 media queries, imagine painful... , keep me lager in weekend... here's me drafting... no pun intended...

edit:

seems haven't stressed key issue enough: mqs need changeable client-side. mentioned, application needs run on wall-mount tv screens of arbitrary size, while have hd or hd-ready resolution, ppi varies lot, , way obtain appropriate scale of design, fire thing , scale fit in app config. going plain ol' mqs won't cut it.

following positive feedback comment, i've created answer people viewing question down line.

when creating application or website needs scale small devices large screens, best use scalable units of measurement. means avoiding use of px in css.

the following units should used best cross-device compatibility , scalability:

%. percentage of screen measure. e.g. 100% 100% of screen, 50% half of screen, , on. straight forward.

rem. size relative root element em size. means whatever base font size document, scales in relation that. if base font size 16px , set 1.5rem, 24px; 1.5 x 16px. ideal when adding accessibility , allowing users increase font size themselves.

em (where things can complicated). size relative direct parent container font size. it's similar rem (see above), multiply further down structure go.

assume following css:

html {     font-size : 16px; }  div {     font-size : 1.5em; } 

when couple nested divs, things can frustrating:

<div>     <!-- font-size 24px !-->     <div>         <!-- font-size 36px !-->         <div>             <!-- font-size 54px !-->         </div>     </div> </div> 

use em's can find things scaling rapidly when didn't expect it.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -