html - 我无法在图像中间找到搜索表单

标签 html css

我试图将我的搜索栏定位在图像的中间。我尝试了以下代码但仍然无法正常工作。有任何想法吗?

.headerimage{ background:#000; position:relative;}
.btn-wrapper{ text-align:center; position:absolute; bottom: 50px; margin: 50 auto; width:100%;}
.img-responsive{
  width:100% !important;
  border-radius:0 0 5px 5px !important;
}
 <section id="contact border-bottom">
      <div class="container">
        <div class="row">
          <div class="col-lg-12 mx-auto text-left">
            <h2 class="section-heading">Locate a Store!</h2>
            <br>
            <p class="mb-5"> Some Text </p>
          </div>
        </div>
        <div class="container-fluid headerimage" style="padding:0 !important">
      <div class="col-md-12" style="padding:0 !important">
        <img class="w3-image" src="{% static 'locator/img/map.png' %}" alt="map" width="1500" height="500">
      </div>
      <div class="container">
      <div class="btn-wrapper">
        <form class="form-inline my-2 my-lg-0">
         <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
         <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
       </form>
      </div>
    </section>

最佳答案

.btn-wrapper {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

关于html - 我无法在图像中间找到搜索表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54396340/

相关文章:

html - 呈现为 flexbox 的有序列表不显示元素符号/小数(元素也呈现为 flexbox)

javascript - jQuery - 调整图像大小以适应 div

javascript - 隐藏具有相同类的所有特定 div 的 Angular 方式是什么

html - 如何从表格 html 设计中删除无用的空间

javascript - 图像和段落交错的问题

html - Div 不会在另一个 div 中居中

javascript - 当我们用VueJS点击图片时,如何独立放大一张图片?

html - iFrame 内容不水平滚动

javascript - 如何使用 js 或 jquery 调整非子图像的大小?

css - 关键帧动画显示 block /无