HTML:
<div id="autocomplete" hidden></div>
<input type = "button" id = "search" value = "Search">
The autocomplete div contains dynamically generated input tags created by jQuery. These input tags cause the button to be shifted down the screen in order to accommodate the autocomplete content. My goal is to have the autocomplete div overlay on top of the button instead of pushing it down.
I have attempted using z-index, but it only seems to work if the autocomplete comes after the button in the HTML structure. I also tried using negative margins to move the autocomplete back up, but this solution is not ideal as it can create issues on different screen sizes.
Is there an alternative approach to achieve this?