mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 13:10:21 +08:00
140 lines
2.6 KiB
HTML
140 lines
2.6 KiB
HTML
<form>
|
|
<label for="search">Search</label>
|
|
<input required="" pattern=".*\S.*" type="search" class="input" id="search">
|
|
<span class="caret"></span>
|
|
</form>
|
|
<style>
|
|
/* From Uiverse.io by Harsha2lucky - Tags: input */
|
|
.input {
|
|
color: black;
|
|
font: 1em/1.5 Hind, sans-serif;
|
|
}
|
|
|
|
form, .input, .caret {
|
|
margin: auto;
|
|
}
|
|
|
|
form {
|
|
position: relative;
|
|
width: 100%;
|
|
max-width: 17em;
|
|
}
|
|
|
|
.input, .caret {
|
|
display: block;
|
|
transition: all calc(1s * 0.5) linear;
|
|
}
|
|
|
|
.input {
|
|
background: transparent;
|
|
border-radius: 50%;
|
|
box-shadow: 0 0 0 0.25em inset;
|
|
caret-color: #255ff4;
|
|
width: 2em;
|
|
height: 2em;
|
|
-webkit-appearance: none;
|
|
-moz-appearance: none;
|
|
appearance: none;
|
|
}
|
|
|
|
.input:focus, .input:valid {
|
|
background: powderblue;
|
|
border-radius: 0.25em;
|
|
box-shadow: none;
|
|
padding: 0.75em 1em;
|
|
transition-duration: calc(1s * 0.25);
|
|
transition-delay: calc(1s * 0.25);
|
|
width: 100%;
|
|
height: 3em;
|
|
}
|
|
|
|
.input:focus {
|
|
animation: showCaret 1s steps(1);
|
|
outline: transparent;
|
|
}
|
|
|
|
.input:focus + .caret, .input:valid + .caret {
|
|
animation: handleToCaret 1s linear;
|
|
background: transparent;
|
|
width: 1px;
|
|
height: 1.5em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(7.5em,-0.25em);
|
|
}
|
|
|
|
.input::-webkit-search-decoration {
|
|
-webkit-appearance: none;
|
|
}
|
|
|
|
label {
|
|
color: #e3e4e8;
|
|
overflow: hidden;
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
.caret {
|
|
background: black;
|
|
border-radius: 0 0 0.125em 0.125em;
|
|
margin-bottom: -0.6em;
|
|
width: 0.25em;
|
|
height: 1em;
|
|
transform: translate(0,-1em) rotate(-45deg) translate(0,0.875em);
|
|
transform-origin: 50% 0;
|
|
}
|
|
|
|
/* Animations */
|
|
@keyframes showCaret {
|
|
from {
|
|
caret-color: transparent;
|
|
}
|
|
|
|
to {
|
|
caret-color: #255ff4;
|
|
}
|
|
}
|
|
|
|
@keyframes handleToCaret {
|
|
from {
|
|
background: currentColor;
|
|
width: 0.25em;
|
|
height: 1em;
|
|
transform: translate(0,-1em) rotate(-45deg) translate(0,0.875em);
|
|
}
|
|
|
|
25% {
|
|
background: currentColor;
|
|
width: 0.25em;
|
|
height: 1em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(0,0.875em);
|
|
}
|
|
|
|
50%, 62.5% {
|
|
background: #255ff4;
|
|
width: 1px;
|
|
height: 1.5em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(7.5em,2.5em);
|
|
}
|
|
|
|
75%, 99% {
|
|
background: #255ff4;
|
|
width: 1px;
|
|
height: 1.5em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(7.5em,-0.25em);
|
|
}
|
|
|
|
87.5% {
|
|
background: #255ff4;
|
|
width: 1px;
|
|
height: 1.5em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(7.5em,0.125em);
|
|
}
|
|
|
|
to {
|
|
background: transparent;
|
|
width: 1px;
|
|
height: 1.5em;
|
|
transform: translate(0,-1em) rotate(-180deg) translate(7.5em,-0.25em);
|
|
}
|
|
}
|
|
</style>
|