Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-05-2012, 09:27 PM   PM User | #1
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Tablets/Mobiles and responsive design

So one of my recent assignment was to create a responsive design for an already existent site. It was no big deal, I made CSS media queries, got it working nicely (enough) scaling from 1920 in width down to 320, accommodating for iPads and iPhones (on both portrait and landscape orientations).

The issue came up when i started the tablet/mobile testing. When I loaded a page on a device, it looked ok, and when I rotated the device from portrait to landscape, the page resized... but zoomed. I had to pinch zoom out to max size to get it to show up properly. It recorded the right dimensions, and the correct CSS was loaded, but it was zoomed in.

I tested out one of the sites the client was using to show us what they wanted (Maxim), and I noticed their site doesn't have that issue. I'm wondering if anyone has experience in development for tablet/mobile devices and might have thoughts as to how I can fix it. It only does it from portrait to landscape, maintaining showing 768px width, then forcing me to zoom out to 1024px. Since landscape to portrait shrinks it, it sizes fine. Do I have to give the body an explicit width? Is there a meta tag I'm not aware of that's necessary?
Keleth is offline   Reply With Quote
Old 09-05-2012, 11:14 PM   PM User | #2
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
Quote:
Originally Posted by Keleth View Post
Do I have to give the body an explicit width?
Maybe width: 100%? I think the mobile device would render everything based on the portrait mode's dimensions.

Code:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
http://chrissilich.com/blog/prevent-...evice-rotates/

There is also:
Code:
@media screen and (max-device-width: 320px) and (orientation: landscape) {}
http://css-tricks.com/snippets/css/m...ndard-devices/

Last edited by Sammy12; 09-05-2012 at 11:34 PM..
Sammy12 is offline   Reply With Quote
Old 09-06-2012, 02:39 PM   PM User | #3
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Some research and I found out it can only be done (as far as I see) by disabling zooming with the viewport meta tag. So if you can't zoom, the system won't try to keep it at its previous zoom "level", and will just fit to max size.
Keleth is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:17 AM.


Advertisement
Log in to turn off these ads.