My experience of Safari (both desktop and mobile) is that it is harder to clear the cache. Are you using Cloudflare as CDN you must also clear this “cache”. This can lead to unpredictable behavior from old cached version.
Due to the css nesting rule that means you are looking for an :active state on a span and spans don 't have interactive states like that. It’s only interactive elements like buttons or anchors that can have an :active state (which is the moment a button is pressed or clicked only).
Therefore that rule is not working in any browser anyway and should be redefined from the button nesting. (Thats why I hate CSS nesting as you can’t easily work out what’s what until the code is formatted and indented properly and is a nightmare to debug).
e.g. This is where you would make active have an effect.
&:active span {
transform: translateY(2px);
}
As I won’t post invalid demos I have changed the html into valid html and changed the css accordingly. (I also added a couple of rules to stop mobile selecting the context menus on touch.)
That works the in mobile and desktop as best it can but of course touch and hover are different things and as I mentioned the :focus state can only be cancelled on mobile by clicking somewhere else. However all the effects are working as I would expect.
Note that you didn’t actually say what was not working so I may have missed your actual point
When you open it directly on mobile your going to see that it displays like this, ignore the scaling on computer to mobile device view. open it directly on saferi mobile you will see the output
ios 15.8.4, I tried to check safari version but failed, i think now i have to make this to work on even old browser versions, is there a way to adjust it to work even on older browser versions
Can you tell me what phone you are using and I’ll look see if there are problems with it?
As a test can you take a screenshot of this Sitepoint page (the one we are on now) on your phone also so I can see if there are problems with any elements on Sitepoint. That may give us a clue as to the problem.
I can’t think of a reason why you can’t see the nice button that is on my screen
BTW I have also checked on a mac laptop using safari and that displays well and also on windows desktop it displays fine in all current browsers.
It’s a mystery but if you can answer the above questions we may get near to solving it. Meanwhile I’ll code a very simple button for you to check and see if that also spreads light on the issue.