Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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
Html 结合翻译和定位绝对问题_Html_Css_Css Position_Transform - Fatal编程技术网

Html 结合翻译和定位绝对问题

Html 结合翻译和定位绝对问题,html,css,css-position,transform,Html,Css,Css Position,Transform,我想将.child放置在.parent的右下角,给出以下html: <div class="parent"> <div class="moved"> <span class="child">Hi</span> </div> </div> 现在,.child的所有位置都是相对于.moved的 所以问题是,在这种情况下,是否有可能定位.child相对于.parent的位置?否,因为transform

我想将
.child
放置在
.parent
的右下角,给出以下html:

<div class="parent">
   <div class="moved">
       <span class="child">Hi</span>
   </div>
</div>
现在,
.child
的所有位置都是相对于
.moved


所以问题是,在这种情况下,是否有可能定位
.child
相对于
.parent
的位置?

否,因为
transform
(值不同于
none
)创建了一个新的,所以
.child
位置现在与
移动的
元素相关,但是您可以使用负的边距,例如
边距:-10px0-10px

例如:


最终结果在视觉上与使用
transform相同:translate3d(-10px,-10px,0)(无论如何,该层不再升级到
GPU


这门课的用途是什么?是否不可能将该孩子作为其兄弟姐妹
transform: translate3d(-10px, -10px, 0);