位置相对不适用于固定位置div [英] Position relative not working for fixed position div

查看:57
本文介绍了位置相对不适用于固定位置div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   div     id   =  outer    style   =  position:relative; width:50px; height:80px; overflow:scroll; >  

< div id = inner 样式 = 高度:100px;位置:固定;宽度:96px; > 有关$ b $的文档b
< / div >

< / div >







内部可见外部div的内容。

解决方案

问题是因为内部 div 宽度( 96 px)大于外层(50px)。



你可以做以下任何一种事情。



1.增加外部 div 宽度

2.制作外部 div 溢出 自动



演示 [ ^ ]


您好,



你需要设置p定位:相对于内部div:



< div id =innerstyle =height:100px; position:relative; width:96px; >

<div id="outer" style="position: relative; width: 50px; height: 80px; overflow: scroll;">

   <div id="inner" style="height: 100px; position: fixed; width: 96px;">documentation on

   </div>

</div>




content of inner visible over outer div.

解决方案

The problem is because the inner div width(96 px) is greater than the outer one(50px).

You can do either of the below things.

1. Increase the width of outer div.
2. Make overflow auto of outer div.

Demo[^]


Hello,

You need to set position: relative for inner div :

< div id="inner" style="height: 100px; position: relative; width: 96px;" >


这篇关于位置相对不适用于固定位置div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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