Html 如何使z索引工作?

Html 如何使z索引工作?,html,angularjs,less,z-index,overlap,Html,Angularjs,Less,Z Index,Overlap,我正在编辑一个角度项目,并尝试修复以下功能: 我将获得以下行为: 以下是HTML代码: <div class="search-function" ng-click="showInputForm()"> <img src="../images/my_project/search.png"> </div> <div class="search-form" ng-if="showForm"> <

我正在编辑一个角度项目,并尝试修复以下功能:

我将获得以下行为:

以下是HTML代码:

    <div class="search-function" ng-click="showInputForm()">
      <img src="../images/my_project/search.png">
    </div>

    <div class="search-form" ng-if="showForm">
      <form ng-submit="textSearch()">
        <input type="text" autofocus class="search-input" ng-model="text.value" />
      </form>
    </div>
我试图将
z-index:-1
设置为
search function
类,但它不起作用。
怎么了?

z-index
仅适用于定位元素。由于未将
position
属性的值更改为默认值(
static
),因此未对其进行定位,因此
z-index
将无效。设置
position:relative

z-index
仅适用于定位元素。由于未将
position
属性的值更改为默认值(
static
),因此未对其进行定位,因此
z-index
将无效。设置
位置:相对

工作!非常感谢。工作!非常感谢。
.search-function {
  margin-left: 30%;
}

.search-form {
  padding-left: 15%;
  padding-right: 15%;

  .search-input {
    color: #2b84a6 !important;
    background-color: #fff !important;
    font-weight: 300;
    font-size: 16px;
  }
}