tags:

views:

23

answers:

2
.classname {
background-image:url(../../images/classname.png);
background-color:transparent;
background-repeat:no-repeat;
text-align:center;
border:none;
height:50px;
width:160px;
font-size:12px;
font-family:Tahoma, Geneva, sans-serif;
color:#CCC;
}

<div class="classname">Text</div> 

Why the Text is above of image? What should I add to make it normal? I can use padding-top, but then the bottom of image will have space too if you know what I mean. Thanks.

A: 

Because the image is a background for the text.

If you're trying to make an image button with text fallback, do <img src="someurl" alt="sometext" />

What do you mean by above?

cthom06
you should try it yourself and you'll see
hey
Well based just on the code there, 'above' would mean 'on top of in the z plane', I can read the CSS. Which would imply to me that you want the text to only appear if the image doesn't. In which case my answer should solve your problem.
cthom06
A: 

I created this for you, I think that's how you want to make it.

Sarfraz