微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

twitter-bootstrap – 引导按钮中的Google Material Icons对齐

如何在我的Bootstrap按钮中正确对齐Google Material Icons?

例如,考虑以下代码

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

<!-- body -->
<button type="button" class="btn btn-danger btn-sm">
  <span class="material-icons">delete</span> Supprimer
</button>

给我这个输出

enter image description here

这不是很好的输出.修复图标和文本之间对齐的最佳解决方案是什么?

解决方法

使用Bootstrap类:

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">


<button type="button" class="btn btn-secondary d-flex justify-content-center align-content-between" (click)="refresh()" [disabled]="loading">
     <i class="material-icons mr-1">refresh</i> <span>Refresh</span>
 </button>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐