.autocomplete { position: relative; display: inline-block; width: 100%; } .autocomplete-items { position: absolute; 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; } .autocomplete-items div { padding: 10px; cursor: pointer; } details summary { padding: 10px; font-weight: bold; }