Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.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 如何使div位于另一个元素(它下面的元素)的正上方?_Html_Css_Margin - Fatal编程技术网

Html 如何使div位于另一个元素(它下面的元素)的正上方?

Html 如何使div位于另一个元素(它下面的元素)的正上方?,html,css,margin,Html,Css,Margin,我希望“上传文件”和“新建目录”这两个按钮位于文本“目录路径:Main”的正上方,但保持在搜索表单的右侧(如图所示) 放一个“边距顶部:11em”或类似的东西确实会使按钮移动到下面(这就是我目前所做的)。但这并不能让网站看起来更好:当你在搜索表单上添加很多标签时,按钮就在同一个地方。或者,当您调整窗口大小时,按钮与搜索保持“太远” 这两个按钮放在一个按钮内。“上传按钮”和“搜索”都放在位置,尝试使它们位于绝对位置,并从顶部和左侧写入特定像素 position: absolute; top:

我希望“上传文件”和“新建目录”这两个按钮位于文本“目录路径:Main”的正上方,但保持在搜索表单的右侧(如图所示)

放一个“边距顶部:11em”或类似的东西确实会使按钮移动到下面(这就是我目前所做的)。但这并不能让网站看起来更好:当你在搜索表单上添加很多标签时,按钮就在同一个地方。或者,当您调整窗口大小时,按钮与搜索保持“太远”


这两个按钮放在一个按钮内。“上传按钮”和“搜索”都放在位置,尝试使它们位于
绝对位置,并从顶部和左侧写入特定像素

position: absolute; 
top: ___px; 
left: ___px; 
我希望这有帮助

    #container {
        position: relative;
    }

search {
    float: right;
    width: 45em;
    height: fit-content;
    background: midnightblue;
    border-radius: 0.5em;
    padding: 1em;
    margin: 1em;
    display: inline-block;
}

#search-form table {
    vertical-align: top;
}


    #search-form td, #search-form tr, #search-form th{
        border-left: solid 0.5em transparent;
        border-right: solid 0.5em transparent;
    }

    /*FILES AND OVERVIEW*/

    #upload-buttons {
        display: inline-block;
        margin-top: 11em;
    }

    .overview {
        clear: both;
    }



    #catalogpath {
        font-size: 2em;
        color: gold;
        white-space: nowrap;
    }
position: absolute; 
top: ___px; 
left: ___px;