Tips for preventing iOS from automatically adjusting font sizes

Not to be confused with zooming the page, I am referring to how MobileSafari on iOS tends to increase font sizes at times.

Under what circumstances does this occur? Is there a way to avoid or minimize it?

Answer №1

body {
    -webkit-text-size-adjust: 100%;
}

Ensure that all text is easily readable from the get-go. Remember, the iPhone and iPod touch have compact screens, so consider this when designing.

Answer №2

Struggled to locate the solution, but finally found it: the key lies in the -webkit-text-size-adjust property within CSS.

Options:

  • Percentage (of default size), for example, 120%, or 100%
  • auto (the default setting)
  • none – recommended as a last resort if auto is not effective. However, using none may lead to difficulties with zooming. It is advised to utilize 100% instead. For instance, when utilizing Safari on a desktop and magnifying the page (Command-Plus), the text remains unenlarged despite the entire page being zoomed! Avoid using none!

It's important to note that these adjustments can be made at various levels, including the page, element, widget, or container level.

(I wouldn't solely set a value of 100% for my website unless I was confident it was optimized for small screens already, and never use none since it leads to issues.)


In Firefox Mobile (e.g. for Android and Firefox OS), there exists a similar property called -moz-text-size-adjust, which is detailed here. Credit goes to Costa for highlighting this.


A decade later: Refer to this MDN page for the most recent information on browser compatibilities and vendor prefixes pertaining to this property.

Answer №3

The solution provided in the response is effective, however, it may cause issues with zooming on other webkit browsers by locking in the font size. By using "100%" instead of "none", the code works universally:

body {
    -webkit-text-size-adjust: 100%;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Populate div with straight lines running vertically or horizontally

I'm wondering how to create vertical or horizontal lines inside a div. I tried this in the past but lost the code, and searching for "fill div with lines" isn't giving me any relevant results. Here's an image to illustrate what I'm try ...

Issue observed with alignment not being corrected when the browser is resized on a responsive webpage

Utilizing Bootstrap3 for my responsive page design. In the banner content, I am including a box with text inside: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <s ...

Having trouble removing or adding a class to an HTML element?

I have a collection of three colored buttons. My goal is to allow users to select one button at a time, triggering it to be highlighted while the others are unselected. Each button corresponds to an object with a property called isSelected that can be set ...

Where would you start looking if the right side of a table border is not visible?

Where should I start looking if the right side border of a table element in a div is not visible? ...

Steps for including a header and footer with page numbers in an HTML page without disrupting the rest of the content when printing

When I print a page with a table that spans multiple pages, I want to ensure that my header and footer are included on every page. The code I've tried so far has treated the entire content as one continuous page. How can I achieve this? ...

What steps do I need to take to integrate casting to Chromecast with the Dailymotion API?

Curious about the process of casting to chromecast with the Dailymotion API. I have the video ID from Dailymotion but need to figure out how to send a media item to chromecast for playback. ...

How can I ensure that the NextJS Image component fills its parent div completely in terms of both height and width?

Having trouble getting the Image component to behave like the img element? Can anyone provide a solution for making Image achieve the same result as shown in the example below? <div style={{ width: "100vw", height: "100vh", display ...

Center the ASP menu horizontally on the page

I'm having trouble centering the menu bar horizontally. The number of main menu items can change with each user login. Currently, the menu bar is starting around 30% from the left. I have attempted using display: inline-block and display: table for #m ...

Is there a way to adjust the selected color of a TextField?

I'm currently working with the Material-UI React library and I am trying to customize the border color of a TextField when it is clicked or in focus. This is my attempt so far: const useStyles = makeStyles((theme) => ({ input: { borderWidth: ...

Conceal the HTML input element until the JavaScript has finished loading

Currently, I am using a JQuery plugin to style a form input with type 'file'. The plugin adds a new span over the input element to create a mask effect and encloses everything in a div. However, there is an issue where the standard HTML input box ...

The modal is not displayed when the on click listener is triggered

I'm a beginner in the world of programming and I'm currently working on creating modals that pop up when clicked. However, I'm facing an issue where the pop-up message doesn't appear when I click the button. Oddly enough, only the overl ...

iOS Safari is displaying the keyboard with a comma instead of a period

Is there a way to display a comma instead of a period on the iOS keyboard in Safari? Upon tapping on the input field, users are presented with a keyboard featuring a period. https://i.sstatic.net/nMFCg.png ...

Tips on accessing a MySQL database with Python using peewee and mysqldb

I am in the process of developing an iOS client for App.net and I am working on setting up a push notification server. Currently, my app has the capability to add a user's App.net account id (a string of numbers) and an APNS device token to a MySQL da ...

Tips for aligning a drop down list in the center

I need help center-aligning my dropdown list to match the buttons that are also center-aligned. Do you have any suggestions on how I can achieve this using .css? <h4 id="carbCount" class="pageElement">The Carb Count is 0</h4><br /> &l ...

What is the best way to resize an image back to its original dimensions using CSS?

Is there a way to maintain the original size and aspect ratio of an image in CSS? HTML <img src="https://www.gstatic.com/webp/gallery/1.jpg" /> CSS img { width: 320px; height: 320px; position: relative; transition: 0.2s ease; } i ...

When I hover over my divs, my span is positioned behind them

Greetings, I apologize for any language barriers. I will do my best to articulate my issue clearly. I have experimented with various approaches and reviewed similar questions, but unfortunately, I am unable to resolve the problem... I have created a title ...

Transforming an image into a geometric shape using html and css - step by step guide

Hey fellow stackoverflow users! I've created a geometric figure using multiple divs for an unconventional website design. However, I'm struggling to adapt images within these divs because the original width is not being maintained. When you view ...

When is the appropriate time to utilize the style attribute in CSS?

Hey there, I'm in the process of building a website from scratch and I've hit a snag. I understand that using the style tag isn't ideal, but would it be acceptable in this scenario? Is there a more efficient approach? Let's consider t ...

What is the process for updating the DisplayName of an iOS App?

I have a question with many answers that are related to my query. How to programmatically rename an XCode project Renaming xcode 4 project along with the actual folder and so on. Take a look at the code snippet below: NSString *plistPath = @"...../Te ...

Dimension of the element that has been positioned absolutely

One of my challenges involves working with an absolutely positioned div element (.tooltip) containing another div (.text) that has text with a set max-width. The issue arises when the left property of .tooltip is too large, causing its width to shrink du ...