Css Position:sticky仅在MOBILE中不起作用

问题描述 投票:0回答:1

我在粘性CSS上的Chrome上遇到问题。仅在移动浏览器上,页面的元素之一不处于粘性位置。 The problem can be seen on the following page

基本上从计算机上,以下代码没有问题,相反,从移动位置开始,页面顶部的红色栏没有处于定义的位置。这是我使用的代码:

.top-bar-copywriting {
   position: -webkit-sticky;
   position: sticky !important;
   top: 0 !important;
   z-index: 2;}

任何人都知道如何解决相同的问题?!预先感谢!

html css wordpress mobile sticky
1个回答
0
投票

粘性不正确,'!important'不需要在那里,z-index也不需要

<style>
.top-bar-copywriting {
position: -webkit-sticky;
position: sticky;
top: 0;
}
<style>
<div class="top-bar-copywriting">
<div class="contentExample>
<h1> Words</h1>
<--!put content here!-->
</div>
</div>

您在使用野生动物园吗? Safari可能无法运行即时贴。你应该得到谷歌。

© www.soinside.com 2019 - 2024. All rights reserved.