I'm trying to design custom buttons. For this I created the following css (see in snippet below).
When I use the css with a <button>
it works as intended. If I use it with a <a>
element instead the button has a width of 100%. I know that using display-block
is the reason for this, but I don't know why it works with my button but not with my <a>
element. They both have the same display property and in my opinion they should behave the same way.
(The buttons should be aligned below each other and be placed in the middle of the parent .buttonRow
).
Both buttons should look like the first example (using <button>
)
.buttonRow {
display: block;
text-align: center;
}
.button {
display: block;
margin: 0 auto;
margin-bottom: 15px;
background-color: #ccad91;
color: white;
font-size: 18px;
padding: 17px 50px;
border-radius: 35px;
border: none;
outline: none;
outline: 0;
}
<div class="buttonRowl">
<button class="button">Proceed</button>
<a class="button" href="index.html">Cancel</a>
</div>