html - 如何定位文本框右侧的按钮?

标签 html css button position

我想使用 CSS 将我的按钮放在右侧。

这是脚本:

<input id="search" class="form-control" type="text" placeholder="Search Location" style="margin-left: 100px; margin-top: 10px; width: 30%; z-index: 1;">

<input type="button" class="btn btn-default" onclick="location.reload();" style="width: 10%; margin-top: 10px; position: absolute; z-index: 1; background-color: #ffffff; border: 1px solid #dce4ec; color: #2c3e50" value="Refresh" />

<div id="map" style="position: relative;"></div>

enter image description here

最佳答案

试试这个

.search-form input {
  display: inline-block;
}
<div class="search-form">
<input id="search" class="form-control" type="text" placeholder="Search Location" style="margin-left: 100px; margin-top: 10px; width: 30%; z-index: 1;">

<input type="button" class="btn btn-default" onclick="location.reload();" style="width: 10%; margin-top: 10px; position: absolute; z-index: 1; background-color: #ffffff; border: 1px solid #dce4ec; color: #2c3e50" value="Refresh" />
</div>
<div id="map" style="position: relative;"></div>

关于html - 如何定位文本框右侧的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42479365/

相关文章:

html - 不同页面上的 Shopify 帮助辅助博客部分

javascript - 带有移动内容的背景拖放

android - 在Android中按下按钮时触发事件

javascript - "Uncaught Error: View type "时间线日"is not valid"完整日历版本3.9.0

html - 使用 HTML5 和 CSS 创建多个背景并保持标记语义的最佳方法是什么?

html - 无法将 css 样式表链接到 html

javascript - 输入提交按钮在 Android 设备上不起作用

css - 简单的 CSS 问题

php - 将 sql 结果显示为 html 可选元素

javascript - 字体仅在之前在页面中使用过后才会出现在 Canvas 上