<div class="p-10">
<div class="w-56 relative group">
<input type="text" id="username" required class="w-full h-10 px-4 text-sm peer bg-gray-100 outline-none">
<label for="username" class="transform transition-all absolute top-0 left-0 h-full flex items-center pl-2 text-sm group-focus-within:text-xs peer-valid:text-xs group-focus-within:h-1/2 peer-valid:h-1/2 group-focus-within:-translate-y-full peer-valid:-translate-y-full group-focus-within:pl-0 peer-valid:pl-0">Username</label>
</div>
</div>
/*! tailwindcss v2.2.6 | MIT License | https://tailwindcss.com*//*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */html{tab-size:4;tab-size:4;tab-size:4;line-height:1.15;text-size-adjust:100%}body{margin:0;font-family:system-ui,system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}hr{height:0;color:inherit}abbr[title]{text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{appearance:button}::focus-inner{border-style:none;padding:0}:focusring{outline:1px dotted ButtonText}:ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:initial}::inner-spin-button,::outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}::search-decoration{appearance:none}::file-upload-button{appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:initial;background-image:none}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}html{font-family:ui-sans-serif,system-ui,system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{font-family:inherit;line-height:inherit}*,:after,:before{box-sizing:border-box;border:0 solid}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}input:input-placeholder,textarea:input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.group-focus-within\:y-full,.peer-valid\:y-full,.transform{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-transform:translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.absolute{position:absolute}.relative{position:relative}.top-0{top:0}.left-0{left:0}.flex{display:flex}.h-full{height:100%}.h-10{height:2.5rem}.w-56{width:14rem}.w-full{width:100%}.transform{transform:var(--tw-transform)}.items-center{align-items:center}.bg-gray-100{--tw-bg-opacity:1;background-color:rgba(243,244,246,var(--tw-bg-opacity))}.p-10{padding:2.5rem}.p-5{padding:1.25rem}.p-7{padding:1.75rem}.px-4{padding-left:1rem;padding-right:1rem}.pl-2{padding-left:.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.group:focus-within .group-focus-within\:h-1\/2{height:50%}.group:focus-within .group-focus-within\:y-full{--tw-translate-y:-100%;transform:var(--tw-transform)}.group:focus-within .group-focus-within\:pl-0{padding-left:0}.group:focus-within .group-focus-within\:text-xs{font-size:.75rem;line-height:1rem}.group:focus-within .group-focus-within\:text-white{--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.peer:valid~.peer-valid\:h-1\/2{height:50%}.peer:valid~.peer-valid\:y-full{--tw-translate-y:-100%;transform:var(--tw-transform)}.peer:valid~.peer-valid\:pl-0{padding-left:0}.peer:valid~.peer-valid\:text-xs{font-size:.75rem;line-height:1rem}.peer:valid~.peer-valid\:text-white{--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.