I am pretty sure that width: 70%;
is causing the problem. %
always depends on the container size and therefore such problems can happen. Try it with using Pixels instead.
Solution 1 :
Problem :
I had implemented an auto-complete functionality for my search box, but autocomplete is moving for different screen sizes it is static for above 600px. I want that to be below my search bar.
CSS for auto complete
.autocomplete-items {
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
/*position the autocomplete items to be the same width as the container:*/
top: 100%;
left: 0;
right: 0;
position: relative;
display: flex;
align-items:center;
flex-direction: column;
}
.autocomplete-items div {
padding: 10px;
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.08);
box-sizing: border-box;
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
width: 70%;
max-width: 630px;
position: relative;
right: 64px;
text-align: left;
}
/*when hovering an item:*/
.autocomplete-items div:hover {
background-color: #e9e9e9;
}
Search bar CSS
.mainSection .searchContainer .searchBox {
border: none;
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.08);
height: 44px;
border-radius: 2px;
outline: none;
padding: 10px;
box-sizing: border-box;
font-size: 16px;
width: 70%;
max-width: 630px;
color: #000;
}
Comments
Comment posted by Jaromanda X
the HTML may help … since that what drives the layout
Comment posted by michaelT
Are there media queries?
Comment posted by Vikas Konaparthi
yes but I did not for this element.