tags:

views:

61

answers:

3

hi , i want to know how to hide button value: i am using style:color: transparent but i didn't know why it doesn't work.

thanks

+4  A: 

Here, this will work in IE and FireFox:

CSS:

  input.noText {
    color: transparent;
    text-indent: -9999px;
    width: 200px; /* set width */
    height: 25px; /* fixed height */
    *margin-left: 9999px; /* IE6 only */
    font-size: 0px;
    line-height: 16px; /* retains height */
  }

HTML:

  <input type="button" value="moo" class="noText" />
Neurofluxation
it hide all the button this is not what i want.
kawtousse
@kawtousse - How about this?
Neurofluxation
+2  A: 

If you just want the button to display without any text on it, set the value as an empty string, then set the height and width of the button manually.

Nathan Reed
no i need the value but i don't want to show it.
kawtousse
why do you need the value? if you just need to store it on the form, then use a hidden input field. I feel like you are going about this the wrong way...
Nathan Reed
+1  A: 

The answer that Nathan Reed proposed is I think the best one. But as you said you need the value, so I think this is what you need
<input type="button" value="my value" style="color: buttonface;">

Bakhtiyor
This doesn't work, the shades of the text are completely wrong in IE8, IE7, IE6 and FireFox 3.6 (at the very least)
Neurofluxation
I don't see any shades on my IE8 and Mozilla. What kind of shades are u talkin' about?
Bakhtiyor
yes it works fine now.
kawtousse