0

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

3 Answers 3

1

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/

Sign up to request clarification or add additional context in comments.

3 Comments

"div.myButton" is redundant, simply putting .myButton is sufficient. (Two can play at this game)
hahahahahaha can't breath ... true but since he's using that method im assuming he has a reason maybe he has another element with the same class with input fields then since its not a id but a class it could be a necessity to do so. Just saying doesn't have to be that way, simple put, a possibility.
jsfiddle.net/EpyGn It works but the problem is that.The image is in the button. I want the image to be displayed instead of the default button . Ex . I want it to be like the "Magnifying lens" as seen as www.entireweb.com
1

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.

4 Comments

I didn't get you mate ? Can you make the modifications in the current code..I"m not able to understand what you said.
@541: it isn't clear from your question where you want the image to appear, so I wouldn't want to suggest any changes. I'm just saying that all the css selectors you've pasted are selecting a elements, and you do not have any <a...> in your code, so none of those styles are applied right now.
Ok,Now i get it.But i did change it and check this : jsfiddle.net/EpyGn The image is displayed in the button and "I want the image TO BE THE BUTTON"...Get it ?
You should've told us :) <input type="image" src="hover.png" />
0

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; }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.