I'm looking to create a dynamic layout where an input field is accompanied by a list in a div, positioned either above or below depending on available space. This setup needs to account for the fact that the input field could be located anywhere on the page. I am considering using viewport dimensions to determine the placement of the div and input field. I would like to achieve this effect using CSS and HTML exclusively. Any suggestions or recommendations on how to tackle this challenge are welcome.
Here is my basic HTML structure:
<input/>
<div id="container">
<ul>
<li ngFor>
<span> field1 </span>
<span> field2 </span>
<span> field3 </span>
</li>
</ul>
</div>