I want to display the label of an input inside its input, so that when I click the input, the label will animate and go above the input and change the styles of the input's border.
Like so:
* {
margin: 0;
padding: 0;
}
form {
width: 100%;
max-width: 500px;
margin: 0 auto;
outline: 1px solid lightgrey;
padding: 10px;
}
label, input[type='text'], input[type='password'] {
font-size: 12pt;
padding: 8px;
}
label {
color: grey;
}
input {
border: none;
outline: none;
border-bottom: 1px solid grey;
}
Run code snippetExpand snippet
How can I achieve this with CSS?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)