Font display in iPhone - iphone-web-app

I develop a simple mobile page; the font displayed is very samll although I set it as 33px and the screen resolution for iPhone is 320 X 480.
Does anyone know why it is so small?
Or the screen resolution is not 320 X 480 since it can be zoomed. Then how do I make the font to be adapted to the resolution automatically?

Safari can be zoomed in and out, so a CSS pixel doesn't always equal a screen pixel (especially when the iPhone 4's denser screen comes out - you wouldn't want your website to be 1/4 the size just because there are more pixels stuffed into the display!).
You can turn off Safari's zooming with a special meta tag, as described in the Apple docs:
<meta name="viewport" content="user-scalable=no, width=device-width" />

Related

Maps and mobile zoom issue

An issue I have with maps on mobile devices is that sometimes when trying to zoom in the map I zoom in the viewport instead - so that the map and text become larger. This happens mostly with inadvertent double taps when out and about, but sometimes happens with pinch zoom. It means that my controls (at the bottom of the viewport) disappear. It can then be rather tricky to (pinch) zoom out the viewport to get the full view of my app back.
The problem is easily fixed by inserting user-scalable=no in the meta, thus:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
But apparently this is a no-no: http://www.w3.org/TR/mobile-accessibility-mapping/#zoom-magnification section 1.4.4
My app is subscription based, and I think the issue of inadvertent viewport zooming is worse than not allowing subscribers to zoom the viewport. So I've left the "user-scalable=no" for now, but am curious to know if there's a way users can say increase zoom on forms but not on maps.
Thanks in advance
Mini
Simple: don't mix your map with other content. Make your map the full screen when you want to zoom the map and then turn off the map zoom when the map is not the whole screen.
There is no other way, because when you zoom your map, you need to call preventDefault, which also disables the standard pinch to zoom.
Note that the documentation says that it should not, that it must:
Restrictive values for user-scalable and maximum-scale attributes of this meta element should be avoided.
When we have a web application, we do want the control to stay at the bottom when we pinch zoom the viewport, like a standard web browser always have its menu bar visible when we zoom inside the content. Web app controls are not part of the content.
Then, you can have a restriction on the viewport size for the full window, as long as your main content (here the map) is scalable.
This will require that your content will always be in an iframe which has no restriction on its scalability.
Your can (and should?) perfectly consider using a font for your controls which is at less 200% of the initial content text size in order to fulfill WCAG recommendations (or must? Definitely).

How to prevent responsive/adaptive skin from shrinking below 360px wide

I'm making a web app I've built responsive. I haven't been able to get some of the screens to get any smaller than 360px wide. But many smartphones are trying to display it at 320px wide. How do make it so it'll be responsive down to 360px but no less?
UPDATE: Prior to posting I had already specified a viewport tag of:
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
And, I set a min-width for the container of 360px.
The issue is that in doing this, 40px on the right are hidden when the user first visits the site as IPhones and many others default to only showing 320px even though they are capable of showing more. I know they can zoom out but I'm wanting it to show 360px wide at load time.
So definately add in the following viewport meta tag in to the head of your html document:
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
You'll need this to really do any responsive work on phones or tablets.
I'm not sure if you want your width to get no wider than 360px or you are stuck at 360px and want to make sure it decreases all the way down to 320px.
If you want it be no smaller than 360px...
You want to have your "wrapper" element be fluid only down to 360px you can set a property on your wrapper div (or whatever element is controlling the width of your site) in CSS to say min-width: 360px;. This will make it so the wrapper element doesn't get any smaller than 360px wide.
If you can't get it to resize smaller than 360px and want it to... This is kind of the reverse of the above. Maybe your wrapper element has a min-width: 360px set. In that case you can remove that property which will allow it to scale narrower than 360px.
I haven't tested this alteration of the viewport, but give this a try.
<meta name="viewport" content="width=device-width, min-width=360, initial-scale=1.0" />
What I'm hoping it will do is make the width equal to the device's width, unless the device's width is less than 360px (aka the iphone) in which case make the width 360px.
Your best bet though is to really switch up your mindset a little bit and use a media query to adapt your code for the best presentation at 320px wide. So let your site be displayed at 320px wide but change the css so the site fits nicely at that width.
For instance:
#media screen and (max-width: 360px){
.wrapper {
width: auto;
}
//change some font sizes
//put float: none on a few elements that were previously floating
//change a few widths of container elements to auto
//etc.
}
The css inside the media query will only get applied if the device is 360px or less.

why samsung s5 display is not what i expected

samsung s5 display:1080 x 1920 pixels but in my media query at this screen size target
#media handheld, screen and (max-width: 970px) {}
the image show the problem:
by the way I used this meta tag inside head tag
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
The "px" unit in CSS doesn't actually mean a physical pixel on the screen. It's a device-independent unit that refers to the (approximate) size of a pixel on a traditional PC monitor, and browsers are expected to scale it appropriately when rendering to a high-DPI device like a printer or a modern "retina" display. So although your phone's screen is 1080 physical pixels wide, it's far fewer CSS pixels wide.
The exact definition of the "px" unit has varied across CSS versions, but all they all define it with approximately the same physical size. CSS3 says "1px is equal to 1/96th of 1in" — the size that a physical pixel would be on a 96dpi monitor.
Wikipedia says that the Galaxy S5's screen is 2.85 inches wide. With 96 CSS pixels per inch, that'd make it about 274px wide from a CSS standpoint.

How can I make a specific, fixed-width DIV on my responsive website scale to fit smartphone screens?

I have a responsive website. I already have...
<meta name="viewport" content="width=device-width, initial-scale=1"/>
...in the header. The website doesn't just scale everything down automatically to fit on a smartphone screen. It maintains the proper size of my DIVs (whether they be fixed or percentages) and I design my elements to fit accordingly.
However, on one page, I have an interactive diagram with several elements. These are blocks (with text inside them), and they have to maintain fixed widths. The problem is, these fixed widths are much larger than smartphone screens. It's about 1000px wide.
I can't make this div percentage based. It has to be at least 1000px wide and maintain that size on every device. Obviously, this means that it will not fit on smartphone screens.
What I would like to do is continuing using...
<meta name="viewport" content="width=device-width, initial-scale=1"/>
...for every other element in my website, except this one DIV. I need to scale the entire parent DIV, its child DIVs and the text inside of the child DIVs.
I have tried the CSS "zoom" property. But, it doesn't scale the text properly, and the widths of the child DIVs don't seem to "zoom" equally. They get out of alignment.
How can I conditionally apply that meta viewport tag to everything except this specific, fixed width DIV?
you need to write a css media query where your page breaks to adjust the div and its nested elements
here is a css3 media query template gist you can use https://gist.github.com/marcobarbosa/798569
or better yet, I would use bootstrap's responsive grid http://getbootstrap.com/2.3.2/
Disclaimer: I'm not exactly certain this is what you're looking for and I don't have enough rep to ask for clarification in a comment, so here's a possibility...
<meta name="viewport" content="width=1000" />
...where "1000"px is the fixed width of the div you're looking to contain. By omitting the "initial-scale" attribute, the device should figure out the scaling it needs to apply for itself.

How can I make a 320 pixel wide mobile site zoom to full width when rotated to landscape?

I've been trying numerous viewport combinations, but can't seem to find the right one.
I have a mobile site that is built to be 320 pixels wide. I'd like these 320 pixels to stretch the full width of the screen in both portrait and landscape mode, regardless of which orientation the screen starts out with, or whether the viewer rotates the device.
Thanks
What is the point of using fixed pixel values when you want the site to stretch?
Just use
width: 100%

Resources