JSFiddle - React, Tailwind, and code Playground
HTML
<main>
<dialog>
<header>
Example
</header>
<div class="content">
<form>
<div class="custom-drop-down-element">
<input />
<ul class="dropdown-list">
<li>Example 1</li>
<li>Example 2</li>
</ul>
</div>
</form>
</div>
<footer>
<button>
Close
</button>
</footer>
</dialog>
</main>
CSS
* {
box-sizing: border-box;
}
main {
background: white;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
position: relative;
}
dialog {
position: fixed;
top: 50%;
left: 0; right: 0;
margin: 0 auto;
transform: translateY(-50%);
background: white;
border: 1px solid black;
width: 400px;
height: auto;
display: block;
padding: 0;
}
header {
width: 100%;
border-bottom: 1px solid black;
padding: 10px;
}
footer {
width: 100%;
border-top: 1px solid black;
padding: 10px;
}
.content {
max-height: 400px;
overflow-y: auto;
width: 100%;
padding: 10px;
}
.custom-drop-down-element {
width: 100%;
position: relative;
}
.dropdown-list {
width: 100%;
position: absolute;
top: 100%;
left: 0; right: 0;
}