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.
button
is designed to be rendered like that butdiv
is not. – Chyack