JSFiddle - React, Tailwind, and code Playground
by Stéphane LEGRAND
HTML
<span class="input input--hoshi">
<input class="input__field input__field--hoshi" type="password" name="requete" maxlength="255" id="input-4" placeholder="votre mot de passe" size="50">
<label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-4">Votre mot de passe</label>
</span>
CSS
.clearfix:before, .clearfix:after { content: ''; display: table; }
.clearfix:after { clear: both; }
.input {
position: relative;
z-index: 1;
display: inline-block;
margin: 1em;
max-width: 350px;
width: calc(100% - 2em);
vertical-align: top;
}
.input__field {
position: relative;
display: block;
float: right;
padding: 0.8em;
width: 60%;
border: none;
border-radius: 0;
background: #f0f0f0;
color: #aaa;
-webkit-appearance: none; /* for box shadows to show on iOS */
}
.input__field:focus {
outline: none;
}
.input__label {
display: inline-block;
float: right;
padding: 0 1em;
width: 40%;
color: #6a7989;
font-weight: bold;
font-size: 70.25%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.input__label-content {
position: relative;
display: block;
padding: 1.6em 0;
width: 100%;
}
.graphic {
position: absolute;
top: 0;
left: 0;
fill: none;
}
.icon {
color: #ddd;
font-size: 150%;
}
/* Individual styles */
/* Hoshi */
.input--hoshi {
overflow: hidden;
}
.input__field--hoshi {
margin-top: 1em;
padding: 0.85em 0.15em;
width: 100%;
background: transparent;
color: #595F6E;
}
.input__label--hoshi {
position: absolute;
bottom: 0;
left: 0;
padding: 0 0.25em;
width: 100%;
height: calc(100% - 1em);
text-align: left;
pointer-events: none;
}
.input__label-content--hoshi {
position: absolute;
}
.input__label--hoshi::before,
.input__label--hoshi::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: calc(100% - 10px);
border-bottom: 1px solid #B9C1CA;
}
.input__label--hoshi::after {
margin-top: 2px;
border-bottom: 4px solid red;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
-webkit-transition: -webkit-transform...