css - android @media query width issue -
i read nice article on @media queries , i'm trying use them format site based on browser width. when test on android phone (android 4.0 browser) seems giving width of 800 pixels when actual width 480. 800 width if phone rotated landscape. right way detect current width in css?
the css used testing: @media , (max-width: 800px) { div.testit800 { display: block; } } @media , (max-width: 799px) { div.testit799 { display: block; } } @media , (max-width: 768px) { div.testit768 { display: block; } }
the html:
<div class="testit800"> max width 800 </div> <div class="testit799"> max width 799 </div> <div class="testit768"> max width 768 </div>
the android shows: max width 800 regardless of orientation.
update: found this page demonstrates several javascript ways of detecting width. window.outerwidth seems work android. reliable across devices , browsers? realize would have give on @media queries use it.
i guess you're doing right way, code shows, don't have @media width 480px.
@media , (min-width: 480px) , (max-width: 599px) { }
this code take pixels range 480(minimum) 599(maximum). should work.
my advice use percentage , not px, percentage fix screen size , pixels fixed.
Comments
Post a Comment