Strange CSS behavior on on Iphone - css

I have an animation on my home page where my logo spins into place. On desktop and both the Chrome and Firefox mobile simulators it works fine but on an actual phone it makes an additional 90deg rotation. Here are screenshots from firefox mobile view and my iphone
This is correct
This is incorrect (iphone)
and the code
#keyframes spin { 100% { transform:rotate(720deg); } }
#keyframes size {
0% { opacity: 0; transform: scale(0); }
30% { opacity: 0; transform: scale(0); }
100% { opacity: 1; transform: scale(1); }
}

Turns out the issue wasn't code related, but rather the Apple browser was reading the image metadata in a particular rotation. The fix was to create a new logo in the correct orientation from the start and now it works fine. I think I may have rotated that last image in the apple viewer after it was exported from Inkscape.
So the desktop browser was seeing the image as is was after rotation and the mobile browser (Apple in this case) was reading the image data and not taking into account the fact that it was rotated.

Related

CSS: Chrome inspector failing with animation using transform and custom css variables

I was debugging a small dropdown with a CSS arrow.
When I tried to inspect it on Google Chrome (latest version, reproduced both on MacOS and Windows), I couldn't see the properties of the arrow:
the same on Safari, Firefox, Edge works just fine:
I have a Codepen where you can see the issue:
https://codepen.io/foyerassurances/pen/9e6fbe8ce9e3c6e767b3b65fb895da79
It is happening because of the transform with custom variables in the keyframes:
#keyframes dropdown-slidefade-open-effect {
0% {
opacity: 0;
transform: translateY(
var(--Dropdown-v-padding)
); // Works in chrome inspector if removed or changed to 16px
}
1% {
opacity: 0;
transform: translateY(
var(--Dropdown-v-padding)
); // Works in chrome inspector if removed or changed to 16px
}
100% {
opacity: 1;
}
}
Is there an issue with the CSS or should I create a Chrome bug case ?
UPDATE:
I have encapsulated the issue in an even smaller Codepen:
https://codepen.io/foyerassurances/pen/f5a0e23f5c3bbfe69bf092e1f3150a44
(transform isn't the issue)

How to zoom out the entire website on wordpress?

I want to zoom out my website when the screen resolution is on 1366*768
the website looks very zoomed-in when chrome is zoom on 100%
I tried
html {
zoom:80%;
transform: scale(1)
transform-origin: 0 0;
}
but nothing works.
Please any help!
You can try this css code. It works with current versions of Chrome, FF, Safari and IE.
html {
zoom: 0.8;
-moz-transform: scale(0.8);
-moz-transform-origin: 0 0;
}

Keyframes rotation jumping around in IE 10

I'm using a basic CSS loading indicator, based on the one from w3schools. It works great except when using IE 10, where it jumps around.
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_loader
Does anyone know of a workaround for IE10?
.loader {
...
border-radius: 50%;
animation: spin 2s linear infinite;
...
}
#keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
I made a test with Document mode using developer tools in IE11.
I notice that it shows the result correctly but it also shows a popup to allow block content.
If you allow it then code get break.
with other older versions of IE it not showing any pop up but also not working.
Below is my testing result.
So You can try to make a test without allowing content to check whether it is working with IE10 or not.

Slow Performing Full Screen Menu On Mobile

This is a strange problem that taken a couple of days worth of Googling many 'fixes' but am yet to find a solution to this strange problem. Here goes.
I have a fixed positioned Menu Button at the top of the screen that when clicked simply allows another fixed postion full screen menu to slide down from the top of the screen. Inspired by the solution at this site:
http://gardenestudio.com.br/
here is the css styles for the overlay menu which contains a single child ul as a test.
.overlay{
width: auto;
height: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgb(59, 69, 97);
transform: translateZ(0);
-webkit-transform: translateZ(0);
transform: translate(0,-100%);
-webkit-transform: translate(0,-100%);
display: inline-block;
-webkit-backface-visibility: hidden; /* Chrome, Safari, Opera */
backface-visibility: hidden;
}
With the following 'SlideIn' and 'SlideOut' keyframes applied
#-webkit-keyframes overlayAnimateIn {
0% {
transform: translate(0,-100%);
-webkit-transform: translate(0,-100%);
}
100% {
transform: translate(0,0%);
-webkit-transform: translate(0,0%);
}
}
#-webkit-keyframes overlayAnimateOut {
0% {
transform: translate(0, 0%);
-webkit-transform: translate(0,0%);
}
100% {
transform: translate(0,-100%);
-webkit-transform: translate(0,-100%);
}
}
However, the problem I am having is that on desktop the performance of the animation is fine.
But on mobile devices.. from Sony Xperia Z2 Compact (vanilla install) etc .. the performance of the animation is terrible.. for the first 10 seconds then after that time interval, the animation is smooth as silk. Note: the gardenstudio solution is smooth at all times.
I have gone through a number of optimisations and reductions of my CSS and HTML to try to find what is causing this problem.
looking at the http://gardenestudio.com.br/ example, i have reduced my stylesheet to around 800 lines (the minimum required to render the page correctly) and the HTML markup is 460 Lines (less than gardenstudio)
If I completely reduce the HTML (leaving the css) to virtually nothing, the animation is smooth.
If I reduce the css (leaving the markup) the animation is smooth..
Something tells me that there is something in my markup and/or css that is computationally expensive and causing a bottleneck.
Can anyone suggest any help finding the bottleneck or if there are any other suggested solutions, that would be great :)
Well after 2 and a half days of reducing, removing and optimising I have found the culprit for now.
We have a body content wrapper that has a Box Shadow applied to it.
Removing this Box shadow solved the problem and the animation is now smooth as anything.
I will continue to slowly re-add all the removed styles etc and report back if I find out why this is causing such a major performance hit.

CSS perspective with rotate & translate issue

I am attempting to make a type of CSS only slide transition from one content section to another. In order to do so in an interesting way, I use CSS's perspective and rotateX to in essence lay down the page content. I then am trying to slide the content out towards the bottom of the screen using translateY
Separately, both the translateY and the rotateX work perfectly, no matter what the perspective is. However, when combined, it only works with certain perspectives based on the window size and rotateY value
In this jsFiddle it works as I would like it to in the window sizes I have tried. The problem is that I would like the perspective value to be lower, around 250px, but I cannot do so without breaking the animation.
I tried using a higher rotateY degree instead of making the perspective lower but the same issue occurs
#keyframes slide {
0% { transform: perspective(450px); }
25% { transform: perspective(450px) rotateX(30deg); }
50%,100% { transform: perspective(450px) rotateX(30deg) translateY(100%); }
}
I have tested this on CSS Deck and jsFiddle both in FireFox and Chrome and it seems to be a consistent issue
Can anyone provide me with a reason why this is happening and offer a work around?
Try setting the perspective as a separate rule on a parent element (as opposed to being part of the transform in the animation).
.parent {
perspective: 250px;
}
#keyframes slide {
25% { transform: rotateX(30deg); }
50%, 100% { transform: rotateX(30deg) translateY(100%); }
}
Updated fiddle: http://jsfiddle.net/myajouri/DYpnU/
My reasoning:
The perspective does not change during the animation so there's no point in having it as part of the animation.
Since your elements occupy 100% of the parent's area, setting the perspective on the parent should produce the same result as setting it on the elements themselves (inside transform).
It seems to solve your problem (see fiddle above).
UPDATE: after more experimentation, I found that explicitly setting the translateY(0) initial value in the animation would solve the issue as well.
#keyframes slide {
0% { transform: perspective(150px); }
25% { transform: perspective(150px) rotateX(30deg) translateY(0); }
50%, 100% { transform: perspective(150px) rotateX(30deg) translateY(100%); }
}
Updated fiddle: http://jsfiddle.net/myajouri/YJS3v/
Only a slight improvement over myajouri answer.
At leats in Chrome, you can write
#-webkit-keyframes slide {
0% { -webkit-transform: perspective(50vh); }
10%,15% { -webkit-transform: perspective(50vh) rotateX(30deg) translateY(0%); }
50%,100% { -webkit-transform: perspective(50vh) rotateX(30deg) translateY(100%); }
}
Setting the perspective to the viewport height should make it more responsive that your current setting
demo
(Untested in other browsers)

Resources