How to style a div like the button-element?

button, css, html

Solution

http://jsfiddle.net/8Sj4A/3/ - this does center vertically and horizontally (just added `text-align: center;` to the originally answer)

div {
    display:inline-block;
    color:#444;
    border:1px solid #CCC;
    background:#DDD;
    box-shadow: 0 0 5px -1px rgba(0,0,0,0.2);
    cursor:pointer;
    vertical-align:middle;
    max-width: 100px;
    padding: 5px;
    text-align: center;
}
div:active {
    color:red;
    box-shadow: 0 0 5px -1px rgba(0,0,0,0.6);
}

Problem

I've noticed that when using the `<button></button>` element, the browsers will naturally assume that you want to center the inline content, and that the element is clickable. Is it possible to have a div behave in the same way through css? I went through the UA-stylesheet to see if I could figure it out, but nothing made it center it vertically. The only other way i know to get the same result is with 2 divs. One wrapper with `display: table`, and a div with `display: table-cell` and `vertical-align: middle`. But that creates an extra div. Is it possible to achieve the same behaviour with just one element? Thanks.

Original source