Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 即使父元素是相对定位的,也可以相对于实体绝对定位元素吗?_Css - Fatal编程技术网

Css 即使父元素是相对定位的,也可以相对于实体绝对定位元素吗?

Css 即使父元素是相对定位的,也可以相对于实体绝对定位元素吗?,css,Css,我没有编辑HTML的权限,所以我只剩下一个边栏,我想相对定位,这样我就可以绝对定位其中的一个元素,但我也希望一个孩子的孩子相对于身体绝对定位,而不是边栏 可视示例: Sidebar (relative) | child (absolutely positioned in sidebar) | child (statically positioned) | | | | child of child (absolutely positioned relative to the body) /

我没有编辑HTML的权限,所以我只剩下一个边栏,我想相对定位,这样我就可以绝对定位其中的一个元素,但我也希望一个孩子的孩子相对于身体绝对定位,而不是边栏

可视示例:

Sidebar (relative)

| child (absolutely positioned in sidebar)

| child (statically positioned)

| | | | child of child (absolutely positioned relative to the body)

/Sidebar

不,不是用CSS。但你可以:

  • 将负值用于
    左侧
    顶部
  • 可能使用JavaScript更改元素在DOM中的位置