Martin
Martin

Reputation: 485

How to show just text inside an INPUT attribute? HTML

I do want to show just text inside an INPUT. So, How can I do it?

<p><input type="image" src="" border="0" name="submit" alt="Donate"></p>

Basically, It works good but Safari and Chrome does not display the alt="Donate. Instead, it shows an empty square.

Edited: I have used this code from bobince:

 <input type="submit" class="unbutton" value="Donate">

.unbutton {
    color: black; background: none;
    border: none; padding: 0; margin: 0;
    overflow: visible;   /* this is an IE hack to avoid extra button width */
}

Then, How can I display the word Donate? I do not want to use an images. I want to use just text to show Donate

PS: I am dealing with PayPal's donation button.

Answer: I have forgot to add value="Donate" :P

Upvotes: 0

Views: 515

Answers (3)

bobince
bobince

Reputation: 536409

It's bad behaviour from WebKit that it doesn't show the alt text, but even so you shouldn't be deliberately using a broken image.

If all you want is a submit button without the button styling, you can do that with CSS:

<input type="submit" class="unbutton" value="Donate">

.unbutton {
    color: black; background: none;
    border: none; padding: 0; margin: 0;
    overflow: visible;   /* this is an IE hack to avoid extra button width */
}

Upvotes: 5

Mitchel Sellers
Mitchel Sellers

Reputation: 63126

I don't think you want to be doing what you are doing here. You are effectively making a dead image link here.

Rather than that, if you are trying to do a submit button or something, use the proper HTML type for this.

Upvotes: 0

Paul Schreiber
Paul Schreiber

Reputation: 12599

Why are you using input type="image"?

How about something like this:

<p><input type="submit" name="submit" value="Donate"></p>

Upvotes: 4

Related Questions