内容出现在固定标题后面 [英] Content appearing behind fixed header
本文介绍了内容出现在固定标题后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我修正了网站的标题部分,但页面的第一个div出现在标题后面;而不是从头部开始。
解决方案
当您应用 position:fixed
或 position:absolute
该元素将从文档流中移除,因此将其视为不存在的元素。这就是为什么你的 div
跳转。要修正应用与您的标题高度相等的 margin-top
- http://jsfiddle.net/2xjES/
I fixed the header section of a website, but the first div of the page appears behind the header; instead of starting from the end of the header.
解决方案
When you apply position: fixed
or position: absolute
the element is being removed from the document flow, so the elements that come after treat it as a non-existent. That's why your div
jumps up. To fix that apply a margin-top
that equals to your header height - http://jsfiddle.net/2xjES/
这篇关于内容出现在固定标题后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文