5416339
5416339

Reputation: 417

Problem with CSS and Button

I have CSS

div.myButton input a {
display:block;
height: 24px;
width: 43px;
padding:10px 10px 10px 7px;
font: bold 13px sans-serif;;
color:#333;
background: url("hover.png") 0 0 no-repeat;
text-decoration: none;
}
myButton a:hover {  
background-position: 0 -44px;
color: #049;
}
myButton a:active {
background-position: 0 -88px;
color:#fff;
}

And then i have HTML

<div class="myButton"><INPUT type="submit" name="" value=""></div>

I don't know where I'm going wrong but I'm unable to view the image !!

Any help ?

Thanks

Upvotes: 0

Views: 164

Answers (3)

Breezer
Breezer

Reputation: 10490

change

div.myButton input a 

to

div.myButton input 

and the other 2 to

div.myButton input:hover

div.myButton input:active

http://www.jsfiddle.net/EpyGn/1/

Upvotes: 1

pooja
pooja

Reputation: 2432

div.myButton { display:block; height: 24px; width: 43px; padding:10px 10px 10px 7px; font: bold 13px sans-serif; color:#333; background-color:#093; background:url(images/add.png); background-image:url(file:///C|/Documents%20and%20Settings/pooja/Desktop/cnn.png) text-decoration: none; } myButton a:hover {
background-position: 0 -44px; background-color:#093; color: #049; } myButton a:active { background-position: 0 -88px; background-color:#093;

color:#fff; }

Upvotes: 0

David Hedlund
David Hedlund

Reputation: 129832

div.myButton input a looks for a div with the class myButton that contains an input, that contains an anchor. You have no such anchor, so the style is not applied to anything.

Upvotes: 1

Related Questions