html - 如何在 Google map 上方使用 Bootstrap 定位内联文本框和按钮?

标签 html css twitter-bootstrap

我需要将文本框和按钮置于内联位置,这是正确的。但是当我尝试不同的 View 示例平板电脑时,文本框适合但按钮留在原位。请看图片。

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

<input type="button" class="btn btn-default" onclick="location.reload();" style="margin-left: 700px; 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>

使用这个@chaitz9:

<input id="search" class="form-control" placeholder="Search Location" style="margin-top: 10px; width: 30%; z-index: 1; margin-left: 100px;" type="text">
<input class="btn btn-default" onclick="location.reload();" style="margin-top: 10px; z-index: 1; background-color: rgb(255, 255, 255); border: 1px solid rgb(220, 228, 236); color: rgb(44, 62, 80); width: 15%;" value="Refresh" type="button">
<div id="map" style="position: relative;"></div>

输出:

enter image description here

enter image description here

最佳答案

已编辑:尝试使用此 CSS。现在,我已将输入字段包装到一个 div 中,并赋予了 display: table 的 div 属性。并到输入字段 display: table-cell

.loc_div{
     display: table !important;
     width:100%;
}

#search{
    margin-left: 100px;
    margin-top: 10px;
    width: 30%;
    z-index: 1;
    position:relative;
    display:table-cell;  

}

.btn {
    background-color: #ffffff;
    border: 1px solid #dce4ec;
    color: #2c3e50;
    margin-top: 10px;
    width: 20%;
    z-index: 1;
    margin-left: 10px;
    display:table-cell;
}
<div class="loc_div">
  <input id="search" class="form-control" placeholder="Search Location"  type="text">
  <input class="btn btn-default" onclick="location.reload();" value="Refresh" type="button">
</div>
<div id="map" style="position: relative;"></div>

关于html - 如何在 Google map 上方使用 Bootstrap 定位内联文本框和按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42478036/

相关文章:

jquery - HTML:尝试从外部 div 获取内部 div 并将该 div 放在外部 div 之外

javascript - html 禁用的文本字段应该允许由 javascript 进行的更改

html - bootstrap 颜色是如何工作的?

jquery - Bootstrap 导航栏折叠不起作用

javascript - BootStrap 导航按钮链接不起作用?

Jquery 验证表单未在 'return true' 上提交

html - 在 CSS 网格中居中

javascript - Google Charts 条形图最后一个值标签截止

html - 无法在页面上居中对齐两个 div

javascript - 如何将图标与 CSS 中自定义卡片组件中的边框对齐?