how to add a placeholder to an input field using css code example
Example 1: css style placeholder
input::-webkit-input-placeholder {/* Chrome/Opera/Safari/Edge */
/*styles here*/
}
input::-ms-input-placeholder { /* Microsoft Edge */
/*styles here*/
}
input:-ms-input-placeholder {/* IE 10+ */
/*styles here*/
}
input::-moz-placeholder {/* Firefox 19+ */
opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/
/*styles here*/
}
input:-moz-placeholder {/* Firefox 18- */
opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/
/*styles here*/
}
input::placeholder {
/*styles here*/
}
Example 2: placeholder text css
input {
border: 1px solid black;
padding: 3px;
height: 300px;
}
input:placeholder-shown {
border-color: teal;
color: purple;
font-style: italic;
}