I Suggest you to use both Input Submit / Button instead of anchor and put this line of code onClick="javascript:location.href = 'http://stackoverflow.com';"
in that Input Submit / Button which you want to work as link.
Submit Example
<input type="submit" value="Submit" onClick="javascript:location.href = 'some_url';" />
Button Example
<button type="button" onClick="javascript:location.href = 'some_url';" />Submit</button>
Style your change the Submit button to an anchor tag instead and submit using javascript:
<a class="link-button" href="javascript:submit();">Submit</a>
<a class="link-button" href="some_url">Cancel</a>
function submit() {
var form = document.getElementById("form_id");
form.submit();
}
The best you can get with simple styles would be something like:
.likeabutton {
text-decoration: none; font: menu;
display: inline-block; padding: 2px 8px;
background: ButtonFace; color: ButtonText;
border-style: solid; border-width: 2px;
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
}
.likeabutton:active {
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
}
(Possibly with some kind of fix to stop IE6-IE7 treating focused buttons as being ‘active’.)
This won't necessarily look exactly like the buttons on the native desktop, though; indeed, for many desktop themes it won't be possible to reproduce the look of a button in simple CSS.
However, you can ask the browser to use native rendering, which is best of all:
.likeabutton {
appearance: button;
-moz-appearance: button;
-webkit-appearance: button;
text-decoration: none; font: menu; color: ButtonText;
display: inline-block; padding: 2px 8px;
}
Unfortunately, as you may have guessed from the browser-specific prefixes, this is a CSS3 feature that isn't suppoorted everywhere yet. In particular IE and Opera will ignore it. But if you include the other styles as backup, the browsers that do support appearance
drop that property, preferring the explicit backgrounds and borders!
What you might do is use the appearance
styles as above by default, and do JavaScript fixups as necessary, eg.:
<script type="text/javascript">
var r= document.documentElement;
if (!('appearance' in r || 'MozAppearance' in r || 'WebkitAppearance' in r)) {
// add styles for background and border colours
if (/* IE6 or IE7 */)
// add mousedown, mouseup handlers to push the button in, if you can be bothered
else
// add styles for 'active' button
}
</script>
Links and inputs are very different things, used for very different purposes. Looks to me like you need a button for the cancel:
<button>Cancel</button>
Or maybe an input:
<input type="button" value="Cancel"/>