Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
JavaScript button not resizing on mobile correctly

I am creating a search bar in my HTML and I am trying to put a magnifying glass button at its end. It looks fine on desktop, but on mobile the button is taller than the search bar. Much thanks if you know how to get it to be the same height on every viewport.

.autocomplete {
  position: absolute;
  top: 50%;
  left: 15%;
}

button[type=reset] {
  background-color: #34587F;
  color: #fff;
  position: absolute;
  border: 0;
  font-size: 2vw;
  border-radius: 10%;
  width: 20%;
  height: 100%;
}
<div class="autocomplete" style="width:40%; font-family: 'Fjalla One'">
  <input id="searchField" type="text" name="search" placeholder="SEARCH" />
  <button type="reset" id="submit" onclick="goTo();"><i class="bi bi-search"></i> 
       </button>
</div>

Appearance on desktop

Appearance on mobile

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like you're setting the height of the reset to height: 100% for the parent autocomplete div. Make sure that you're also setting the height of the input/searchField to the same height (i.e. 100%) to match that of the reset button. If they're styled the same, make sure you set a height for the autocomplete class. Having an unset height for an absolutely positioned parent, with relative height children, may be causing your issues.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!