[英]What to do when I have a “position: fixed;” header & an image slider “position: relative;” just below the header?
I have made a header using the CSS property, position: fixed;
我已经使用CSS属性( position: fixed;
& just below the header part I have included an image slider with a CSS property, position: relative;
在标题部分的正下方,我包括了一个带有CSS属性的图像滑块, position: relative;
. 。 My problem is that when scrolling down the page the images tend to interfere with the header part. 我的问题是,当向下滚动页面时,图像往往会干扰页眉部分。 Please tell me what to do? 请告诉我应该怎么做?
.header{position: fixed; background-color: black;}
.sliderbox{position: relative; width: 1200px; animation-duration: 20s; animation-name: slideranimation;}
@keyframes slideranimation{0%{left: 0px;} 20%{left:0px;}.....}
Use z-index
option to keep the header always on top, like this: 使用z-index
选项可以使标题始终位于顶部,如下所示:
.header {
z-index: 2; /* This value is sufficient if the other content does not have a z-index value. */
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.