<label for="food">What would you like?</label>
<div class="input-group">
<input list="foods" name="browser" id="food">
<button commandfor="food" command="show-picker">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="icon" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
</svg>
<span class="sr-only">Open input picker</span>
</button>
</div>
<datalist id="foods">
<option value="🍙 Onigiri"></option>
<option value="🍜 Ramen"></option>
<option value="🍣 Sushi"></option>
<option value="🥟 Dimsum"></option>
</datalist>
@import url("https://fonts.googleapis.com/css2?family=Reddit+Mono:wght@200..900&display=swap");
/* Style the input group with invoker */
.input-group {
display: flex;
input {
font-family: "Reddit Mono", monospace;
border-image: repeating-linear-gradient(
to bottom in oklch,
oklch(80% 0.3 323) 0%,
oklch(90% 0.3 112) 100%
);
border-width: 0.35rem;
border-image-slice: 1;
background: #333;
color: #fff;
font-size: 2rem;
padding: 1rem;
}
[commandfor] {
cursor: pointer;
color: #fff;
background: linear-gradient(
to bottom in oklch,
oklch(80% 0.3 323) 0%,
oklch(90% 0.3 112) 100%
);
border: 0;
padding: 0 1.2rem;
}
}
datalist {
background-color: blue;
color: red;
}
.icon {
width: 2.2rem;
aspect-ratio: 1;
}
body {
font-family: "Reddit Mono", monospace;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
font-family: "Open Sans", sans-serif;
font-size: 1.3rem;
line-height: 1.6;
min-block-size: 100dvb;
display: flex;
background: #474056;
color: #fff;
}
label {
font-family: "Reddit Mono", monospace;
}
.sr-only {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
width: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.