Skip to content Skip to sidebar Skip to footer

How To Get Orientation:portrait Mode With Meta Viewport With A Fixed Height

time for my first own stackoverflowquestion, since this thing is driving me crazy the whole day now. i borrowed an ipad today to test a website wich comes with additional phone and

Solution 1:

so i was getting tired of this and wrote a javascript-hack. wich is possible, since i have a fixed width on that layout as well. not my type of solution, but hell yeah... (and it is not working in the opera-mini on the ipad i got here since it doesnt deliver any usable dimensions... - i could test safari, dolphin and operamini)

document.body.style.marginLeft = Math.floor((window.innerWidth - 477) / 2) + 'px';

to be on the safe side you should css:

html { width:100%; }

i'm still interested in a real solution. (or someone telling me, that i am wrong in understanding the viewport. ...or confirming, that is a browserbug)

Post a Comment for "How To Get Orientation:portrait Mode With Meta Viewport With A Fixed Height"