强制“位置:绝对"相对于文档而不是父容器 [英] Force "position: absolute" to be relative to the document and not the parent container

查看:73
本文介绍了强制“位置:绝对"相对于文档而不是父容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将div插入正文的任何​​部分,并使它的position: absolute相对于整个文档,而不是相对于具有position: relative的父元素.

I am trying to insert a div into any part of the body and make its position: absolute relative to the whole document and not a parent element which has a position: relative.

推荐答案

您将必须将div放在position:relative元素之外,并放入body.

You will have to place the div outside of the position:relative element and into body.

这篇关于强制“位置:绝对"相对于文档而不是父容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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