Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.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_Position - Fatal编程技术网

Html 绝对元素未置于相对元素之上

Html 绝对元素未置于相对元素之上,html,css,position,Html,Css,Position,在我的标题中,我试图将挂起按钮通知放置在图像购物车图像上。由于某些原因,pending按钮通知div显示在标题div的左侧 有人知道为什么这个位置不正确吗 这是有问题的代码: <div id="pending-order-button"> <a href="pendingOrders.html"><img src="images/cart.png" class="header-buttons" alt="Car"> <div id

在我的标题中,我试图将
挂起按钮通知
放置在
图像购物车
图像上。由于某些原因,
pending按钮通知
div显示在标题div的左侧

有人知道为什么这个位置不正确吗

这是有问题的代码:

<div id="pending-order-button">
    <a href="pendingOrders.html"><img src="images/cart.png" class="header-buttons" alt="Car">
        <div id="pending-button-notification"></div>
    </a>
</div>

是您的
浮动:右
上。标题按钮
导致了问题


我建议您删除该选项,并浮动
#挂起的订单按钮
div,以便将其及其所有内容移到右侧。

是您的
浮动:右侧
上。标题按钮
导致问题


我建议您将其移除,并浮动
#挂起的订单按钮
div,以便将其及其所有内容移动到右侧。

您的图像向右浮动,定位在左侧您的图像向右浮动,定位在左侧
#pending-order-button {
    position: relative;
    float:right;
}