32 CSS Search Box & Search Bar Designs
Border Trace
On focus, two halves of a border trace simultaneously around the input — a clean line-drawing reveal. No box-shadow, no gradients.
Border Trace the 30th of 32 designs in the 32 CSS Search Box & Search Bar Designs collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<form class="csb-trace" role="search"> <label class="csb-sr" for="csb-trace-i">Search</label> <input id="csb-trace-i" type="search" name="q" placeholder="Search..." /> <span class="csb-trace-tl"></span> <span class="csb-trace-br"></span> </form>
.csb-trace {
position: relative; display: inline-block;
padding: 0;
}
.csb-trace input {
width: 240px; padding: 11px 14px;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.08);
border-radius: 8px;
color: #f0eeff; font: 500 14px/1 system-ui, sans-serif;
outline: none;
transition: border-color 0.15s;
}
.csb-trace:focus-within input { border-color: transparent; }
.csb-trace input::placeholder { color: #b8b6d4; }
.csb-trace-tl, .csb-trace-br {
position: absolute; pointer-events: none;
border-color: #7c6cff;
border-radius: 8px;
}
.csb-trace-tl {
top: 0; left: 0;
width: 0; height: 0;
border-top: 1.5px solid transparent;
border-left: 1.5px solid transparent;
}
.csb-trace-br {
bottom: 0; right: 0;
width: 0; height: 0;
border-bottom: 1.5px solid transparent;
border-right: 1.5px solid transparent;
}
.csb-trace:focus-within .csb-trace-tl {
width: 100%; height: 100%;
border-top-color: #7c6cff;
border-left-color: #7c6cff;
transition: width 0.25s ease, height 0.25s ease 0.25s;
}
.csb-trace:focus-within .csb-trace-br {
width: 100%; height: 100%;
border-bottom-color: #7c6cff;
border-right-color: #7c6cff;
transition: width 0.25s ease 0.5s, height 0.25s ease 0.25s;
}
.csb-sr {
position: absolute !important;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
More from 32 CSS Search Box & Search Bar Designs
Glitch SearchCompact MobileFocus Ring BloomInset PressedFloating CardAurora DriftVoice SearchLoading SpinnerExpanding InputInline SuggestionsTagged FilterRecent Searches
View the full collection →