我想在文本输入框的起始部分显示搜索图标 。
目前我的代码是这样的:
<div id="search-icon"></div>
<input type="text" name="search" id="search"/>
和我的CSS:
#search-icon {
display:inline-block;
background-color:#455a21;
height:60px;
width:60px;
border:thin solid black;
border-radius:30px;
z-index:100;
}
input#search {
position:relative;
top:-25px;
left:-30px;
padding:10px;
padding-left:35px;
border-radius:20px;
border:thin solid #6d6e71;
z-index:1;
}
它向右显示 div 位置, 但是在实际文本框下方。 当我将搜索图标位置更改为绝对时, 它会破坏我的定位 。
我该怎么打?