Jump to content

[SOLVED] Can I make an a href look like a submit?


marmite

Recommended Posts

So, everyone is trying to do the opposite (to get their submits to look like regular links), and this is all I find on Google.

 

I'm sure this is really easy.

 

I have an <a href which doesn't need to POST any information... but as I have another submit on the page it looks silly to have this as a link or an image. I'd like it to look like a button.

 

It falls over when I simply try to add a form in with no inputs except the submit. Thanks ???

Well, you're not going to get the link to look exactly like the submit buttons unless you style both of them a tad. The default button look is nigh impossible to duplicate on non-button elements, but with a little tweaking, we can get close.

 

Let's say you've got an <a> tag with a class of "pseudo_button" on it. Here is the CSS I would recommend you start with in order to begin your quest:

a.pseudo_button {
  text-decoration: none;
  background-color: #F4FAFA;
  padding: 2px 10px;
  border: 1px solid #2D5082;
  cursor: arrow;
  color: #000000;
  font-size: 11px;
}

 

This may be a good start, and then you can do whatever you need to modify it from there.

 

Good luck!

(I am surprised: I thought it would be really easy to insert a submit button as an <a href... rather than trying to format my image/link to look like that)

 

You could always use some javascript to tell a button to act like a link instead:

<input type="submit" value="myLink" onclick="window.location('newpage.html'); return false;" />

 

The only consideration is that a redirect like this requires javascript, and some people don't like requiring users to have it enabled. This would definitely be easier and a little more accurate, though, since you are using a submit button for the redirect.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.