JSFiddle - React, Tailwind, and code Playground

by Minsup Kim

HTML

<div>
    <label for="inp">댓글을 입력하세요</label>
    <input type="text" id="inp">
</div>

CSS

div {position:relative}
div:after {z-index:999;position:absolute;bottom:0;left:50%;width:0;height:0;background:#333;content:'';
  -webkit-transition:all 0.2s ease-out;
  transition:all 0.2s ease-out
}
.on:after {bottom:-1px;left:0;width:100%;height:2px}
div label {position:absolute;top:0;left:0}
.on label {color:#ccc}
input {width:100%;border:0;border-bottom:1px solid #ccc;background:transparent;outline:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}

JavaScript

$(function(){
    $("input").on("focus", function(){
        $(this).closest("div").addClass("on");
    });
    $("input").on("blur", function(){
        $(this).closest("div").removeClass("on");
    });
});