::प्लेसहोल्डर छद्म-तत्व का उपयोग करके, हम टेक्स्टबॉक्स के लिए प्लेसहोल्डर टेक्स्ट का रंग बदल सकते हैं।
CSS ::प्लेसहोल्डर छद्म तत्व का सिंटैक्स इस प्रकार है -
::placeholder {
attribute: /*value*/
} उदाहरण
निम्नलिखित उदाहरण CSS ::प्लेसहोल्डर छद्म-तत्व को दर्शाते हैं।
<!DOCTYPE html>
<html>
<head>
<style>
input:last-child::placeholder {
color: cornflowerblue;
}
</style>
</head>
<body>
<input type="text" placeholder="Default color" />
<input type="text" placeholder="Check my new color :D" />
</body>
</html> आउटपुट
यह निम्नलिखित परिणाम देगा -

उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
input::placeholder {
color: fuchsia;
}
input {
margin: 2%;
width: 100%;
}
div {
display: flex;
flex-direction: column;
margin: 3%;
padding: 3%;
text-align: center;
align-items: center;
box-shadow: inset 0 0 30px brown;
}
button {
width: 40%;
}
</style>
</head>
<body>
<div>
<input type="text" placeholder="Normal placeholder" />
<input type="email" placeholder="somenone@somewhere.com" />
<button>dummy btn</button>
</div>
</body>
</html> आउटपुट
यह निम्नलिखित परिणाम देगा -
