I am showing a message on my website with the following style:
.basic-message {
position:fixed;
top:3%;
right:3%;
z-index: 1000;
cursor: pointer;
}
it works fine in Desktop browsers, see the screenshot
or try it yourself.
but it does not work in mobile Chrome on Android where the message is positioned at the top-right corner of the page (but not window) as if its positions is 'absolute'.
Looks like it is a known problem and I successfully tried adding the meta tag:
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi">
this makes 'fixed' work well as on Desktop, but also makes the website unscalable that is unacceptable.
Also I tried adding
-webkit-backface-visibility: hidden;
but it does not take an effect (at least on my Android phone).
Is there some other solutions or workarounds?
EDIT1:
The message itself is absolutely trivial:
.basic-message p {
color: #ffffff;
font-size: 1.4rem;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
border-radius: 0.25em;
padding: 16px;
}
.error-message p {
background: #e94b35;
}
<div class="basic-message error-message">
<p>The text goes here.</p>
</div>
Also, for example, this page has a sample 'fixed' element at the right-bottom corner of the window that stops working correctly in mobile Chrome after scaling the page.
EDIT2:
Adding -webkit-transform along with -webkit-backface-visibility as follows
.basic-message {
position:fixed;
top:3%;
right:3%;
z-index: 1000;
cursor: pointer;
-webkit-transform: translate3d(0,0,0);
-webkit-backface-visibility: hidden;
}
also does not take an effect.
EDIT3
In MS Edge mobile emulator it also glitches, see the screenshots below:
it jumps and periodically disappears when I scroll the page: