简体   繁体   English

为什么我的页面固定标题覆盖页面内容下方?

[英]Why is my page fixed header overlays below the page content?

I'm using these style lines. 我正在使用这些样式线。 Please check why header is showing below page content? 请检查标题为何显示在页面内容下方? http://gtcgroups.com/ This is the website kindly tell me what i should do? http://gtcgroups.com/这是该网站告诉我我应该怎么做?

.header-normal .site-header.fixed-on  {
    background: #383780;
    opacity: 0.9;
    height: 130px;
}

You have a z-index:20 in your code. 您的代码中有一个z-index:20

You can use a z-index:21; 您可以使用z-index:21; on your header to make it appears above the page content. 放在标题上,使其显示在页面内容上方。

向您的CSS添加z-index:21或更多,它将起作用

z-index is used to define stack order of html elements. z-index用于定义html元素的堆栈顺序。 HTML elements with greater stack order is always in front of an element with a lower stack order. 具有较高堆栈顺序的HTML元素始终位于具有较低堆栈顺序的元素的前面。

header{
    z-index: 9999;
}

It will increase page header stack order than page content stack order. 它会比页面内容堆栈顺序增加页面标题堆栈顺序。

Make sure that your Fixed header z-index value is greater than z-index of the other sections 确保您的固定标头的z-index值大于其他部分的z-index

for example, 例如,

.header-normal .site-header.fixed-on  {
    background: #383780;
    opacity: 0.9;
    height: 130px;
    z-index: 9999;   
  }

The z-index property in CSS controls the vertical stacking order of elements that overlap. CSS中的z-index属性控制重叠元素的垂直堆叠顺序。 As in, which one appears as if it is physically closer to you. 如图所示,哪一个似乎在物理上离您更近。 z-index only effects elements that have a position value other than static (the default). z-index仅影响位置值不是静态值(默认值)的元素。

Without any z-index value, elements stack in the order that they appear in the DOM (the lowest one down at the same hierarchy level appears on top). 没有任何z-index值,元素按照它们在DOM中出现的顺序堆叠(在同一层次结构级别中最低的元素显示在顶部)。 Elements with non-static positioning will always appear on top of elements with default static positioning. 具有非静态定位的元素将始终显示在具有默认静态定位的元素顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM