::placeholder प्सूडो-एलिमेंट का उपयोग करके, हम टेक्स्टबॉक्स के लिए प्लेसहोल्डर टेक्स्ट कलर बदल सकते हैं।
CSS ::placeholder प्सूडो-एलिमेंट का सिंटैक्स निम्नानुसार है:
::placeholder { attribute: /*value*/ }
उदाहरण 1
निम्न उदाहरण CSS :: placeholder प्सूडो-एलिमेंट को दर्शाते हैं।
<!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>
आउटपुट
यह निम्न परिणाम उत्पन्न करेगा:

उदाहरण 2 (सभी इनपुट पर)
<!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>
आउटपुट
यह निम्न परिणाम उत्पन्न करेगा:
