How do I create a button binding in Bootstrap 4?

When I use the button, it looks like this in Bootstrap 4:

enter image description here

<button type="button" class="btn btn-primary" target="_blank">Download</button>

When I use the anchor instead of the button style it looks like this:

enter image description here

<a type="button" class="btn btn-primary" target="_blank">Download</a>

How can I bind an anchor to a flat button?

+3


source to share


1 answer


First of all, remove type="button"

from <a>

. You need to update the css and write your own css for the tag <a>

.



a.btn {border-radius: .25rem; border: 1px solid transparent; padding: .5rem 1rem; color: #fff; }
a.btn:hover { border-radius: .25rem; }
      

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn btn-primary" target="_blank">Download</button>
<a class="btn btn-primary" target="_blank" href="#">Download</a>
      

Run code


+2


source







All Articles