html - 在 div 底部放置表单字段

标签 html css forms css-position

我想在 div(div.content) 的左下角放置一个表单字段 (div.invoer)

<body>
 <div id="container" style="width:1280px";"height:800px">

   <div id="header" style=;"background-color:#FFA500;""width:1280px";"height:200px">
     <h1>EXPORT ZENDINGEN</h1>
   </div>

   <div id="menu" style="background-color:#FFD700;height:600px;width:700px;float:left;">

   </div>

   <div id="content" style="background-color:#EEEEEE;height:600px;width:580px;float:right;">

      <div id="invoer">
        <form method="post" action="">
        <label>Debiteur</label>
        <input type="text" name="deb_nmr" />
        <br />
        <label>Klantnaam</label>
        <input type="text" name="cost_name" />
        <br />
        <label>Aantal Pallets</label>
        <input type="text" name="numb_pallets" />
        <br />
        <label>Totaal Gewicht</label>
        <input type="text" name="tot_weight" />
        <br />
        <label>PB Nummers</label>
        <input type="text" name="PB's" />
        </form>
      </div>
   </div>
</div> 
</body>

使用了以下 Css:

label{
    display:inline-block;width:100px;margin-bottom:10px;
}

.content{
    position: relative;

}

.invoer{
    position: absolute;
    bottom: 0px;
}

使用了来自 W3school 的信息,但无法开始工作。找到了有关堆栈溢出的更多信息,例如使用相对位置和绝对位置。但是表单保留在内容 div 的左上角。

最佳答案

content 和 invoerids 而不是 classes 所以使用它们的正确方法是 #content ,#invoer 不是 .Content , .content

Everything is correct just replace the following css from this:

label{
    display:inline-block;width:100px;margin-bottom:10px;
}

#content{
    position: relative;

}

#invoer{
    position: absolute;
    bottom: 0px;
}

to this:

label{
    display:inline-block;width:100px;margin-bottom:10px;
}

#content{
    position: relative;

}

#invoer{
    position: absolute;
    bottom: 0px;
}

Here is the updated code.

label{
    display:inline-block;width:100px;margin-bottom:10px;
}

#content{
    position: relative;

}

#invoer{
    position: absolute;
    bottom: 0px;
}
<div id="container" style="width:1280px ; height:800px">

  <div id="header" style=" background-color:#FFA500; width:1280px;height:200px">
    <h1>EXPORT ZENDINGEN</h1>
  </div>

  <div id="menu" style="background-color:#FFD700;height:600px;width:700px;float:left;">

  </div>

  <div id="content" style="background-color:#EEEEEE;height:600px;width:580px;float:right;">

    <div id="invoer">
      <form method="post" action="">
        <label>Debiteur</label>
        <input type="text" name="deb_nmr" />
        <br />
        <label>Klantnaam</label>
        <input type="text" name="cost_name" />
        <br />
        <label>Aantal Pallets</label>
        <input type="text" name="numb_pallets" />
        <br />
        <label>Totaal Gewicht</label>
        <input type="text" name="tot_weight" />
        <br />
        <label>PB Nummers</label>
        <input type="text" name="PB's" />
      </form>
    </div>
  </div>

关于html - 在 div 底部放置表单字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43557271/

相关文章:

javascript - 当图像超出限制时停止视差效果

html - CSS:将图像放在另一个图像的背面

jquery - 仅将类添加到前置文本

jquery 不链接到 html

javascript - 将 D3.js 创建的下拉菜单交换为 HTML 创建的下拉菜单

javascript - 表单 onsubmit 内联 javascript

javascript - 使用单选按钮显示/隐藏具有相同类的多个 DIV

javascript - 使用 javascript 选择复选框时隐藏表单元素

javascript - Ajax - 将 JSon 渲染为 HTML : View vs Controller

javascript - 以 html 输出时 Bootstrap 弹出窗口不起作用