简体   繁体   中英

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 :

在此输入图像描述

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

Apply the btn class to the a instead.

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

Also take a look at the docs .

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM