हम .cur एक्सटेंशन (इंटरनेट एक्सप्लोरर के लिए), .gif और .png (क्रोम, फायरफॉक्स, सफारी के लिए) जैसे एक्सटेंशन के साथ एक कस्टम कर्सर इमेज बना सकते हैं और इसे CSS cursor प्रॉपर्टी का उपयोग करके एक एलिमेंट पर लागू कर सकते हैं, इसे एक URL पर सेट करके और इसके अलावा एक जेनेरिक कर्सर मान जैसे auto, default, pointer, आदि।
समाधान
Selector { cursor: url("/*path to custom cursor file*/"), generic cursor; }
उदाहरण
आइए एक उदाहरण के साथ कस्टम कर्सर बनाना देखें:
<!DOCTYPE html> <html> <head> <title>Custom Cursor Using CSS</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } #tech1 { cursor: url("https://www.tutorialspoint.com/images/dbms.png"), auto; } #tech2 { cursor: url("https://www.tutorialspoint.com/images/Python.png"), auto; } </style> </head> <body> <form> <fieldset> <legend>Custom Cursor Using CSS</legend> <h1>Learn</h1> <input type="button" id="tech1" value="DBMS"> <input type="button" id="tech2" value="Python"> </fieldset> </form> </body></html>
आउटपुट
उपरोक्त कोड के लिए आउटपुट:
'DBMS' बटन पर होवर करने पर:

'Python' बटन पर होवर करने पर:
