内容与"position:fixed"重叠 [英] Content overlapping with "position:fixed"

查看:99
本文介绍了内容与"position:fixed"重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 position:fixed CSS值下方的代码中给出 header DIV时, content DIV会上升并重叠.如何将内容DIV保留在标题下方?

When I give the header DIV in the code below a position:fixed CSS value, the content DIV goes up and overlaps it. How can I keep my content DIV below the header?

这是我的代码:

<div class="header"  style="width:100%; height:50px; positon:fixed;" ></div>    
<div class="content" style="width:100%; height:800px;"></div>           
<div class="footer"  style="width:100%; height:40px;"></div>

推荐答案

为div提供 position:fixed 属性 top:0 .content div margin-top:50px (固定的 .header div的高度):

Give the div with position:fixed property top:0 and the .content div margin-top:50px (the height of the fixed .header div) :

示例

这篇关于内容与"position:fixed"重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆