style input placeholder code example
Example 1: html select placeholder
Placeholder attribute does not exist for the <select> tag.
But there are some ways to make a placeholder for the select box.
The easiest way of making a placeholder for the <select> element is using the disabled and selected attributes with the HTML5 hidden global attribute.
<select name="monthname" required>
<option value="" selected disabled hidden>Select Month</option>
<option value="Jan">January</option>
<option value="Feb">February</option>
<option value="Mar">March</option>
<option value="Apr">April</option>
<option value="May">May</option>
<option value="Jun">June</option>
<option value="Jul">July</option>
<option value="Aug">August</option>
<option value="Sep">September</option>
<option value="Oct">October</option>
<option value="Nov">November</option>
<option value="Dec">December</option>
</select>
Example 2: css style placeholder
input::-webkit-input-placeholder {
}
input::-ms-input-placeholder {
}
input:-ms-input-placeholder {
}
input::-moz-placeholder {
opacity: 1;
}
input:-moz-placeholder {
opacity: 1;
}
input::placeholder {
}
Example 3: placeholder css
::-webkit-input-placeholder {color: pink;}
::-moz-placeholder { color: pink;}
:-ms-input-placeholder { color: pink;}
:-moz-placeholder {color: pink;}
Example 4: placeholder color in css
*::-webkit-input-placeholder {
color: red;
}
*:-moz-placeholder {
color: red;
opacity: 1;
}
*::-moz-placeholder {
color: red;
opacity: 1;
}
*:-ms-input-placeholder {
color: red;
}
*::-ms-input-placeholder {
color: red;
}
*::placeholder {
color: red;
}
Example 5: input placeholder css
::placeholder {
color: red;
}