Safari iPhone sometimes increases font size when going back - css

I've made a webpage for myself: http://av.nettfolk.no/
When I use Safari on my iPhone (5 and 6, 9.2.1), tap on a link to a certain site (Inma), and then go back to my site, some fonts increase in size.
For the other sites, they don't change when I go back to my site.
If I visit this certain site, and go two pages deep, then go back two steps to my site, then the fonts are the right size.
I've tried a bunch of things, but I just can get this to work.
Does anyone know why this is and how I can fix it?

It worked when I double checked one of my previous attempts and found that I had written a line wrong. This worked:
html {-webkit-text-size-adjust: 100%;}
I never found out why Safari only enlarged the fonts when I was coming back from certain sites.

<meta name=viewport content="width=device-width, initial-scale=1">
I wonder if the =viewport doesn't have quotes upsets it -> name="viewport"
Like here:
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1.0" />
It also helps to specify font size in the body (and html for some browsers), so:
html, body {
font-size:100%; /* <-- equivalent to 16px */
}

Related

Font-sizing vw buggy on mobile Chrome

I am developing a website with slightly different CSS code for desktop and mobile. On mobile I use vw units for responsive font-sizes, which is preferred over media queries as mobile screen sizes change every other year and a different approach would require me to update the media queries as well every time.
Now, I think I have found buggy behaviour in Chrome mobile when it comes to font sizes with vw.
I kindly invite you to check out these two pages on mobile, both with Firefox and Chrome:
http://gusto-gelateria.al/
http://gusto-gelateria.al/ice-cream-recipes/
Firefox is correctly showing the font-sizes as i expected, while on Chrome:
font sizes are wrong throughout the page
the font size in the footer on the first page is different than on the second page ( footer fonts are the same on both pages on Firefox, as expected )
Am I missing something here, or Chrome doesn't handle well vw?
If this is not an obvious coding error I did, I may file a bug, but I want a confirmation before doing it.
Take as an example this vw declaration for the footer:
footer address div {
display: block;
font-size: 3vw !important;
}
That declaration appears in both browsers' dev tools as well, so it is being rendered both on Firefox and Chrome, but apparently they interpret it in different ways.
As I said above, my CSS for mobile is different than on desktop, so for inspecting it you should use the mobile device emulation from the browser dev tools (for Chrome see https://developers.google.com/web/tools/chrome-devtools/device-mode/ )
I believe that the root of your problem is that you don't have a viewport meta tag in the head of either of your pages. Without this, the default behaviour of browsers is to scale the page to fit the screen.
Start by adding the viewport tag in the head of all your pages:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title here</title>
...
</head>
Once you do this you'll see more consistent behavior between browsers, and from one page to another.
More about the viewport meta tag
Hope this helps!
The font-size difference is likely Mobile Chrome font-boosting. Elements with dynamic height get boosted automatically. A solution is to give the element or parent a max-height:
.parent {
max-height: 999999px;
}
But it's probably best to apply that max-height directly to the element containing your text so it doesn't effect anything else you might be doing in your layout.
Test it on a real device, since Chrome's Dev Tools doesn't show the boosting.

Same size font looks like a different size

As you can see, both of these buttons have text that's the same font-size, but appear very different in size.
With devtools open you can see that both buttons have font-size: 16px They are also both the same font ('Roboto').
Any idea what could be causing this discrepancy?
To clarify, I am working on recreating a website that's currently on WordPress. While I do have access to the back end on WordPress, it's handled by the theme so I can't see the actual code.
I think you forgot to add
<meta name="viewport" content="width=device-width, initial-scale=1.0">
That's why it looks like small.
http://www.w3schools.com/css/css_rwd_viewport.asp

How can I create a website with a responsive design?

I built sites and want to make it mobile responsive.
It is perfectly working on Chrome and Firefox but not on mobile.
I tested on Inspect though it is working properly on desktop browsers but not for mobile.
How can I fix this?
First and foremost, you should add a viewport on the HTML page.
Type this inside the head tag:
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
Then, I personally think it's better if you link a bootstrap.css file. And I also recommend to use the media screen of CSS like this:
#media screen and (max-width: 800) {
/* The CSS codes when the device is less than 800 go here */
}
At least, that's how I do it.
And you can go and download or watch the video that I saw on YouTube. I don't remember it's name or link but its length is over an hour and the guy was making a webpage of a gym website.
I highly recommend to type these on your own rather than copying and pasting it, it will help you understand what each thing means, to not forget the codes so that you don't refer these kind if simple things.

CSS media queries pixels not matching set width

Been trying to debug this for a couple of hours. I've been asked to fix a "responsive" website that is really buggy. I can't share the actual code b/c it's all on localhost on a secured network. Hoping you might see something have a light bulb go off from my description here.
Problem, we have #media (max-width:800px) and it stops affecting page elements around 600px wide.
Another example, i set html{ max-width:1200px} but to make the browser actually fit my 1200 pixel browser window I had to set it to 2250px.
My question is, does this ring any bells for anyone? I'm going through all the CSS and don't see any thing that immediately looks like the issue. These guys really broke responsive design.. bleh
Thanks..
EDIT
here's the meta tags that apply
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
... bunch of junk...
<meta name="viewport" content="width=device-width, initial-scale=1"> (again)
With some help, I was able to resolve the issue.
Issue was related to pixel-ratio declaration but not in CSS, in minified Javascript...
Eliminating this unnecessary js made the page load as expected.
Core lesson: use javascript for functionality and CSS for design and layout.

Fonts are showing big in ipad , breaking the layout, how to solve this?

I'm Making a website for Desktop+iPad. Site look fine in Desktop browsers including Safari.
but in iPad fonts are big and breaking the layout.
This problem can be solved if i use
body {
-webkit-text-size-adjust:none;
}
But according to this info http://www.456bereastreet.com/archive/201011/beware_of_-webkit-text-size-adjustnone/ this code applies to Desktop Safari. user in Desktop safari cannot adjust the size which is not good for site's accessibility
is there any other alternative to solve this big text problem in iPad.
Use this instead:
-webkit-text-size-adjust:100%;
Also, make sure you are setting the initial zoom setting to 1 in your viewport meta tag:
<meta name="viewport" content="width=device-width; initial-scale=1.0;" />

Resources