Answer the question
In order to leave comments, you need to log in
Strange behavior of position: absolute; How to decide?
There is a project in which there is a search with an icon (magnifying glass),
if it is viewed on android everything is OK, the magnifying glass occupies the position given to it.
A small code, as it is all spelled out:
<div class="header__top-search">
<div class="search">
<form action="" class="search__form">
<input type="text" name="search" class="search__input" value="Более 250 наборов" required="" onblur="if(this.value=='') this.value='Более 250 наборов';" onfocus="if(this.value=='Более 250 наборов') this.value='';">
<input type="submit" value="" class="search__submit">
</form>
</div>
</div>
.header__top-search {
float: left;
width: 21%;
}
.search {
position: relative;
}
.search__input {
padding: 7px 30px 7px 12px;
background: rgba(255, 255, 255, 0.25);
border: 0 none;
color: white;
font-family: "PT Sans", sans-serif;
font-size: 13px;
font-weight: 400;
outline: none;
width: 100%;
border-radius: 14px;
background-clip: padding-box;
-webkit-appearance: none;
}
ну и иконка:
.search__submit {
background: url("../img/search.png") 0 0 no-repeat;
width: 13px;
height: 13px;
display: block;
border: none;
position: absolute;
right: 13px;
top: 50%;
margin-top: -6.5px;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question