The CSS scale transformation in iOS Safari causes the page to zoom out

I am attempting to implement a text snippet that will "zoom and fade in" upon the page loading. In order to do this, I am creating a div containing the text and applying an immediate transform to it:

.whatIwantZoomed {
  opacity:0;

    /* Add Vendor Prefixes */
  transform:scale(4,4);

    /* Add Vendor Prefixes */
  transition:transform 1s, opacity 1s;
}

When invoked from my Javascript function, an animated class is added which reduces the scale to (1,1):

.whatIwantZoomed.animated {
  opacity:1;

    /* Add Vendor Prefixes */
  transform:scale(1,1);
 }

The issue arises on mobile Safari (both iOS 7 & iOS 8), where the scaled text ends up larger than the viewport width, causing a 'resize' and zoom effect on the page. Once the animation completes, the page returns to its normal state.

I am trying to find a solution to prevent this unintended alteration of the viewport width. I have attempted setting the body to overflow-x:hidden; with no success, and adjusting the viewport meta tag has not helped either.

If anyone has insight or a possible solution to this problem, I would greatly appreciate it. Thank you.

EDIT: Here is a fiddle showcasing this issue. Take note of the scrollbars in the HTML frame - this is what I aim to avoid.

Answer №1

Give this a go Check out the DEMO

div {
    text-align:center;
    background-color:red;
    transform-origin: 50% 50%;
    transform:perspective(1200) scale(1);
    animation:animated 1s ease-in-out;    
}

@keyframes animated{
    from{transform:scale(10);opacity:0}
}

Answer №2

If you stumble upon this issue, it may be linked to this known bug

The main reason behind this problem is elements outside the visible screen causing Safari (or wkwebview) to inaccurately resize the viewport.

To mitigate this issue, include the following in your viewport meta tag:

shrink-to-fit=no

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

Randomly positioning an image while the page is loading

I've been developing a portfolio website to showcase my design work, but I've encountered a minor issue. My goal is to have the images load in random positions and then make them draggable using Dragabilly. However, sometimes all the images end ...

What is the best approach to styling a sub-child element within the first child using TailwindCSS?

Currently working with React (Next.js) and TailwindCSS. <ul> <li> <h1 className="bg-red-400">first</h1> </li> <li> <h1 className="bg-green-400">second</h1> </li> &l ...

Is there a way to modify the style value within AngularJS?

<div class="meter"> <span style="width: 13%"></span> </div> I have the following HTML code snippet. I am looking to update the width value using AngularJS. Does anyone have a solution for this issue? ...

Broken link in navigation bar

I encountered an issue with the navigation bar on this website. When I click on "Leistungsspektrum" in the navigation bar, it returns a message stating that The requested URL /leistunsspektrum.html was not found on this server. However, the actual file nam ...

How can I implement user-specific changes using Flask?

I am a beginner with Flask and I am working on a project where users can sign up, and if the admin clicks a button next to their name, the user's homepage will change. Below is the Flask code snippet: from flask import Flask, redirect, url_for, render ...

Adding style tags dynamically to a component and then encapsulating the styles again (using Angular)

Currently, I am in the process of upgrading from AngularJS to Angular. Our app is currently a hybrid one being bundled up with webpack instead of just angular cli. Due to this setup, we have encountered issues where our css or scss files are not correctly ...

Tips for assigning a badge value to the sixth item on my tab bar:

Could someone help me figure out how to set the badge value on my 6th tabbaritem? I've been able to do it on the 4th tabstaritem using self.tabbaritem.badgevalue=@"", but for some reason, the same principle isn't working for my 6th tabbaritem. I ...

Explore the styling options for SVG using CSS to manipulate different properties of the

After saving my SVG image in Illustrator, the code appears like this: <?xml version="1.0" encoding="utf-8"?> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBo ...

How to Automatically Arrange UICollectionViewCell by a JSON Parameter in Swift

I am currently working on a UICollectionView that is populated with cells from JSON response data. The cells are currently being sorted alphabetically, which matches the sorting in the JSON file. However, I would like to sort them based on the "Likes Count ...

Creating overlapping layouts with absolute positioning in Bootstrap leads to a visually appealing

I'm currently working on a layout that involves absolute positioning elements, similar to the one shown in this example: https://i.sstatic.net/TixbZ.jpg It seems like the elements are overlapping and not clearing properly. I've been looking for ...

What steps should be taken to animate a ViewController sliding from the bottom to the top?

Currently, I have a SlideInTransition class that smoothly adds a ViewController with animation from left to right. However, I am looking for a transition effect from bottom to top. import UIKit class SlideInTransition: NSObject, UIViewControllerAnimatedT ...

Is the absolute positioned element on the left or right based on its current location?

Is there a way to assign absolute positioning with left at 0px or right at 0px depending on whether the positioned div will go outside of its container? For example, when you right click in a browser and see the menu appear to the right of where you click ...

The z-index is not functioning correctly when outside of the container

Using bootstrap, I am attempting to display an element outside of the container. [html] <div class="container"> <div class="element"></div> </div> [css] .element{ position:absolute; right:0; top:0; z-index:999;} Issue: The blo ...

Tips for utilizing StoryBoard references in UITableView or UICollectionView

In my app, I have a table view where each cell opens up a unique flow of view controllers when clicked. Although Xcode 7 introduced storyboard references for linking flows in different storyboards, I'm unsure if this feature can be used for UITablevi ...

Troubleshooting a crash issue upon app launch with Unity integration in a Swift 3 project: Investigating the root cause of

Greetings to all my fellow programmers, I am currently working on implementing an exported Unity project into my native Swift project. To accomplish this task, I referred to the guidelines provided in a tutorial available at: https://github.com/blitzagen ...

Why is it not possible for me to place my image and text side by side?

I've been working on my personal portfolio website and ran into an issue when trying to position the image with text that says Ib student. I attempted using the bootstrap box model which didn't work, followed by using float, but that also didn&ap ...

The function cannot be applied to d[h] due to a TypeError

Having some trouble with my code here. I'm trying to set up routes to display a gif using CSS animation when the page is loading. The gif shows up initially, but then everything fades out and the gif remains on the page. Additionally, I'm getting ...

Creating a notification for specific choices in a dropdown menu

I am working on a form that includes a select element with multiple options. Depending on the option selected, a different form will be displayed. My concern is if a user starts filling out one form and then decides to select another option, I want to add ...

Swapping one div for another, all the while incorporating a limited number of buttons within the webpage

I'm faced with a dilemma on my HTML page. In the middle of the content, there's a div that contains 4 links with images and text inside. What I'm looking to achieve is for each link to trigger a complete change in the div when clicked, with ...

Modify the color of the footer area and eliminate any underlines present

In the footer section, the tags are displaying in blue color and I would like to remove the line under the li tags. If necessary, I can provide additional HTML or CSS code for reference. Below is the snippet of HTML and CSS related to the footer: My HTML ...