Responsive Web Design, Pulling Up Keyboard on Mobile Device Messes Up Design - html

I created a responsive design for my website. It's based on the contents of the website being inside a div which has a height of 100% of the window. The problem is that when a user clicks on an input field, the size of the browser shrinks to fit the area between the keyboard and the top url bar on a mobile phone browser. This makes my design look very odd while the keyboard is up.
Any idea how this can be fixed? I haven't seen this happen on other responsive sites, but haven't really observed closely either.
I have the following in the head of my html file:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Basically, I want the area which would otherwise be covered by the keyboard to be hidden when they keyboard is up, not pushed upward and squish my whole layout.
EDIT: I fixed it by doing this
$("#comment-text-area").focus(function() {
var height = $("body").css('height');
$("body").css('height', height);
});

Perhaps you could use javascript to detect when an input field is focused, then set the window's pixel size to whatever it was before the focus, then reset it back to auto when the field is unfocused?

As far as I know mobile browsers not resize the window when the keyboard is show, they only move and cover the window.
Maybe you problem is the way you are achieving the 100% height, is there any vendor specific css or a JS handing the resize events?

You could try adding user-scalable=false; to the viewport meta tag, but more than likely resize-on-field-focus is an un-override-able feature of the browser itself. It's usually a good thing to have, even at the cost of design, because people generally enjoy larger text areas to see what they're typing so I'd personally recommend against using this.
<meta name="viewport" content="width=device-width, user-scalable=false;">

Related

Dynamically shrink div when resolution gets smaller | Viewport or overflow issue

I'm facing the problem of building a responsive website.
Main part of the site is a with a fixed width of 62em. Now I want this div to shrink as a whole if the resolution gets smaller, with no scrollbars shown and no zoom used.
Currently when I open the site in a smaller resolution, scrollbars are shown but I do not have the opportunity to zoom out
Curently I'm using a flexbox design and Chrome as debug tool. What I'm really wondering about is, that sometimes the seems to work the way I want in Chrome's dev mode and sometimes it does not. I have really no idea why this behaves so randomly.
I'm interessted in a solution using only CSS.
Does anyone have a tip?
My viewport is set to
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
Could a overflow issue may cause this problem?
Your best bet is probably to work with % values to max-width so it never grows bigger than your viewport size. Flexbox can have some weird behaviours sometimes. If you share some of your code I'll maybe be able to help you a little better.

Resize Chrome responsive mode window without changing scale

I used to be able to open developer tools, click the little icon bottom right to open responsive mode and then drag the window width handle to change the device width.
This was really useful to see how a website would perform on different devices.
However now it just changes the scale of the page, not the width - this is rubbish.
How can I change the width keeping a fixed scale?
EDIT:
Oh - may bad. It was just the website I was on. Others work fine like it used to. Oh well.
You need this meta tag in the head section:
<meta name="viewport" content="width=device-width,initial-scale=1">
This answer comes from here.
Use Toggle Device Mode by pressing the CTRL SHIFT M sequence and the page should scale if its components are responsive.

alternative to zoom that all browsers support

I'm making a prototype sight currently that is static (as in when the screen is resized smaller such as 480 pixels the sight does not responsively adjust its elements ). I actually don't want the sight to be responsive I want it to behave as apple.com does. Apples site is a large zoomed out overview of the site allowing the user to zoom in on what he/she wishes to. Whenever my sight is loaded on my iphone it is zoomed in to a tip corner of the site. When I apply zoom:.5 to the css it zooms out just as much as i would like it to in IE and chrome but does not in Firefox. Obviously that's a major problem being firefox is a very popular browser and i am having difficulties finding an alternative. If any one could offer any amount of alternatives (even using javascript) it would be much appreciated.
If I understand you correctly, you need to set the viewport meta.
Add the following to the head section of your site:
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
This will set the initial zoom to fit the entire page, while allowing users to zoom as they please.
this is quite easy...
just do all your code in old fashioned pixel measurements
and nothing will resize and it wont be responsive at all

How can I make a site automatically fit device width, without needing to zoom out?

I have a responsive website that I think looks best when it's 500px or larger, so I set the min-width to 500px.
However, I'm testing it on a 320px phone and pages have horizontal scroll, forcing me to zoom out if I want everything on the screen.
Is this a device issue? Or is there some code I can use to make my site shrink by default? (instead of having to zoom out each time I navigate to a new page)
<meta name="viewport" content="width=device-width, initial-scale=.6">
Then just adjust scale to fit what you need
I used bootstrap in my pages, it save you this hassle, try it it is very helpful in many ways.
from here.
and also has many other futures.
this is a google search for free wordpress templates.

Optimize a web page for Palm Pre

I'm in the process of building a support page for my pre application.
I'm having a problem where the content on the page is very small, so the user has to manually zoom in to read it.
I've made the page so that there is nothing very wide or tall, but for some reason everything is very "zoomed out" when you first navigate there on the Pre.
I've noticed that sites like wikipedia have versions that are perfectly optimized for the Pre. How can I make my pages start out "full-sized" the way wikipedia does?
Update:
The extremely simple page that I am currently testing with.
On the above page I have tried setting the width for every element to both 310px and to 100%, the result is always the same.
I figure I can accomplish this by giving everything a static width and then making everything use a very big font size. I'm just guessing that there is a "better way", i.e. some way to let the pre browser know that it doesn't need to start zoomed out to the size of a "normal" web page (it seems that the default zoom is about 1024px wide, even though the actual rez is 320px).
I found out the proper way to do this on the webOSDev forums.
The following should be in the header:
<meta name="viewport" content="width=device-width"/>
<meta name="viewport" content="initial-scale = 1.0"/>
This has the advantage that when the user turns the device into landscape mode, everything scales appropriately, without any styling gymnastics.
Posting a URL of a problem page would be a big help here.
In general, to show nicely on smartphones, the design of the page has to be "fluid" (taking 100% of the width in percent - not specified in pixels) to use the most space in differing screen resolutions. The minimal width supported by the design should be about 300 pixels, to fit without zooming on 320x480 screens.