1

Possible Duplicate:
How do I make an html link look like a button?

I've looked around on the web. Found some links to very colorful buttons that don't look like buttons at all :-)

Is there anyone out there that has some CSS they found or came up with that could help me to make my links look like "real" buttons that I see when I use a "submit" type button in a form.

I don't mind if the CSS uses graphic backgrounds. Just looking for something that simulates a button as close as possible. I could also use jQuery as I have that on my page.

Thank you very much

Community
  • 1
  • 1
Robert Dawson
  • 153
  • 1
  • 2
  • 10

7 Answers7

9

For instance:

a {
    background:#eee;
    text-decoration:none;
    color:#333;
    font-family:Arial, sans-serif;
    font-size:11px;
    font-weight:bold;
    padding:3px 5px;
    border:1px solid #aaa;
    border-radius:3px;
    cursor:default;
}

a:hover {
    background-color:#f2f2f2;
    border-color:#888;
    box-shadow:0 0 2px #ccc;
}

a:active {
    vertical-align:-1px;
}

Live demo: http://jsfiddle.net/QTRpb/1/show/

Šime Vidas
  • 182,163
  • 62
  • 281
  • 385
6

In webkit and gecko there is the -webkit-appearance and -moz-appearance properties that does what you want. I'm not sure on support in other browsers – you'd need to check. Here's a demo:

http://jsfiddle.net/kZ2WE/2/

In CSS3 there is a standard property appearance, but, as of june 2013, it isn't supported in any browser.

The proprietary extensions work for Chrome, Safari (webkit) and Firefox (mozilla). It isn't supported at all nor in IE niether in Opera.

JotaBe
  • 38,030
  • 8
  • 98
  • 117
Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
2

You could just use buttons instead of anchor elements. Don't put the button in a form and the page won't change when clicked. Give the buttons unique IDs, and have jquery attach event handlers to the buttons' click events that open a new web page.

$(document).ready(function(){
    $("#mybutton").click(function(){
        window.open("mypage.html");
    });
});
Joshua Welker
  • 547
  • 1
  • 9
  • 20
1

Maybe this could be useful for you: 22 CSS Button Styling Tutorials and Techniques.

mhmpl
  • 1,045
  • 2
  • 13
  • 29
0

Try the brief tutorial at the below link, it shows how to use a button as a hyperlink. Not sure what would happen with all those forms if you had loads of these on the same page though!

http://www.htmlgoodies.com/tutorials/buttons/article.php/3478871/So-You-Want-A-Link-Button-Huh.htm

hermiod
  • 1,158
  • 4
  • 16
  • 27
0

Super Awesome Buttons from Zurb. Requires some CSS3

Rob Cowie
  • 22,259
  • 6
  • 62
  • 56
0

How hard did you look? I googled

"how to make a button using css"

And got excellent links.

The ones I used in the past are:

http://www.thesitewizard.com/css/3d-buttons.shtml

http://www.brainjar.com/dhtml/menubar/

If you google "css button generator" you will also get interesting sites:

http://www.iwebtoolsonline.com/html-and-css-rounded-corner-button-generator

http://css-tricks.com/examples/ButtonMaker/

cquezel
  • 3,859
  • 1
  • 30
  • 32