javascript - 如何将输入定位在屏幕底部?

标签 javascript jquery html css

我需要放置一个 <input><div> 里面这样当用户滚动时,<input>位置保持相对于屏幕。我试过relativeabsoluteposition: ,但它们都不是相对于屏幕,而是相对于页面大小。

.console {
  position: absolute;
  right: 0px;
  background-color: #fff;
  width: 300px;
  height: 600px;
  border: 1px solid black;
  overflow-y: auto;
}

.run {
  position: absolute;
  bottom: 0px;
  width: 295px;
}
<div class='console' height='600'>
    <input class='run' type='text' placeholder='I want this to be relative to the bottom of screen' />
</div>

代码片段显示了 <input>停留在页面底部;我需要它位于用户屏幕的底部。最简单的方法是什么?

最佳答案

我使用了 position: fixed; 并且成功了。

关于javascript - 如何将输入定位在屏幕底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55104302/

相关文章:

javascript - 根据元标题隐藏元素

javascript - 如何将子框架中的location.href更改为相对路径?

javascript - Select2() 不是函数

javascript - jquery 在滚动上工作

javascript - 如何不告诉浏览器不保存缓存

html - 导航不在 div 内

javascript - 使用 AngularJS 比较文本字段中的数字

javascript - jQuery:表单数据不支持的媒体类型

javascript - 用变量替换字符串值

javascript - 单击 crossridder 中的上下文菜单时如何打开弹出窗口对话框?