There's a style for a button, that can be applied to a
-elements and button
-elements:
.button {
appearance: none;
display: flex;
justify-content: center;
align-items: center;
width: auto;
min-width: 150px;
min-height: 50px;
margin: 0 auto 20px auto;
padding: 0;
border: 1px solid black;
background: white;
font-size: 1.4rem;
}
<a class="button">a-element</a>
<button class="button" type="button">a-element</button>
While this works fine, there's a difference in rendering:
- the
a
-element has 100 % width of the parent container - the
button
-element doesn't stretch and is centered
I'm not sure which browser default style property for buttons causes this.
How can I make the a
-element to behave like the button
?
So, the element is centered but not stretched.