2012-09-22 13 views
6

मैं इसे class="myButton" में परिभाषित करके सबमिट बटन को प्रतिस्थापित करने की कोशिश कर रहा हूं और सीएसएस में शैलियों को बदल सकता हूं। क्लिक किए जाने पर myButton:active काम नहीं कर रहा है।सीएसएस में एक छवि बटन सेट करना - छवि: सक्रिय

.myButton{ 
    background:url(./images/but.png) no-repeat; 
    cursor:pointer; 
    border:none; 
    width:100px; 
    height:100px; 
} 

myButton:active { 
    background:url(./images/but2.png) no-repeat; 
} 

एचटीएमएल कोड:

<input class="myButton" type="submit" value=""> 

उत्तर

19

चेक इस link

यहाँ मेरी सीएसएस है। myButton से पहले आप . खो रहे थे। यह एक छोटी सी त्रुटि थी। :)

.myButton{ 
    background:url(./images/but.png) no-repeat; 
    cursor:pointer; 
    border:none; 
    width:100px; 
    height:100px; 
} 

.myButton:active /* use Dot here */ 
{ 
    background:url(./images/but2.png) no-repeat; 
} 
+0

ओह शूoot! धन्यवाद महोदय! – user1666411

+0

कोई समस्या सिर्फ इसे ऊपर उठाने और उत्तर के रूप में स्वीकार करने के लिए :) –

+0

सभी बटन जो मिल गए हैं .myButton क्लास बदल जाएगा ... –

संबंधित मुद्दे