<label>
Opacity:
<input class="opacity" placeholder="Search">
</label>
<label>
Color:
<input class="color" placeholder="Search">
</label>
html, body {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background: gray;
}
input {
background: white;
}
.color::placeholder {
transition: color ease 0.2s;
color: transparent;
}
.color:ms-input-placeholder {
transition: color ease 0.2s;
color: transparent;
}
.color:focus::placeholder {
color: #a9a9a9;
}
.color:focus:ms-input-placeholder {
color: #a9a9a9;
}
.opacity::placeholder {
transition: opacity ease 0.2s;
opacity: 0;
}
.opacity:ms-input-placeholder {
transition: opacity ease 0.2s;
opacity: 0;
}
.opacity:focus::placeholder {
opacity: 1;
}
.opacity:focus:ms-input-placeholder {
opacity: 1;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.