我有一个fixed
定位的元素。 CSS如下所示
header {
position: fixed;
left: 0;
top: 0;
width: 100%;
padding: 20px 30px;
border-bottom: 1px solid rgba(255, 255, 255, 0);
}
如果我将位置static
,元素将从屏幕上消失。如何重新显示该元素?
答案 0 :(得分:1)
position: static
与相对位置(top
,left
,right
,bottom
和z-index
)不兼容,并将覆盖这些设置。您的元素将遵循正常的页面流程。
position: relative
就像静态的一样,但是将保留这些设置。请注意,位置将相对于当前页面流。