Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement <a> tag in bootstrap button

Demo JS Fiddle:

I can't implement the href into the buttons.

It will work if I put it this way :

<a href="/">
    <button type="button" class="btn btn-default btn-custom">
        <span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>
        <br />
        <span class="btntext glyphicon-class">PP bậc thang</span>
    </button>
</a>

But this will result in this mess :

enter image description here

Is there any simple way I can fix this? Thanks alot!

like image 313
NeedAnswers Avatar asked Dec 19 '22 09:12

NeedAnswers


2 Answers

Apply the btn class to the a instead.

<a href="/" class="btn btn-default" ...

Also take a look at the docs.

like image 197
Mooseman Avatar answered Jan 08 '23 14:01

Mooseman


I updated your fiddle for the buttons to work properly:http://jsfiddle.net/ettmujvg/9/

 <a href="#"  class="btn btn-default btn-custom">
      <span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>
      <br />
      <span class="btntext glyphicon-class">PP bậc thang</span>
 </a> 
like image 21
Jan_dh Avatar answered Jan 08 '23 13:01

Jan_dh