您也可以使用字体图标代替图像。
CSS
.button {
min-width:175px;
border-radius:50px;
background:none;
outline:none;
border:none;
color:#fff;
padding:15px 25px;
margin-top:10px;
background: rgba(115,84,178,1);
background: -moz-linear-gradient(45deg, rgba(115,84,178,1) 0%, rgba(115,84,178,0.95) 34%, rgba(115,84,178,0.95) 35%, rgba(96,107,192,0.91) 62%, rgba(84,160,231,0.85) 100%);
background: -webkit-gradient(left bottom, right top, color-stop(0%, rgba(115,84,178,1)), color-stop(34%, rgba(115,84,178,0.95)), color-stop(35%, rgba(115,84,178,0.95)), color-stop(62%, rgba(96,107,192,0.91)), color-stop(100%, rgba(84,160,231,0.85)));
background: -webkit-linear-gradient(45deg, rgba(115,84,178,1) 0%, rgba(115,84,178,0.95) 34%, rgba(115,84,178,0.95) 35%, rgba(96,107,192,0.91) 62%, rgba(84,160,231,0.85) 100%);
background: -o-linear-gradient(45deg, rgba(115,84,178,1) 0%, rgba(115,84,178,0.95) 34%, rgba(115,84,178,0.95) 35%, rgba(96,107,192,0.91) 62%, rgba(84,160,231,0.85) 100%);
background: -ms-linear-gradient(45deg, rgba(115,84,178,1) 0%, rgba(115,84,178,0.95) 34%, rgba(115,84,178,0.95) 35%, rgba(96,107,192,0.91) 62%, rgba(84,160,231,0.85) 100%);
background: linear-gradient(45deg, rgba(115,84,178,1) 0%, rgba(115,84,178,0.95) 34%, rgba(115,84,178,0.95) 35%, rgba(96,107,192,0.91) 62%, rgba(84,160,231,0.85) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7354b2', endColorstr='#54a0e7', GradientType=1 );
}
您可以在上述样式中删除button 类中的background 和filter 部分。我只是将它用于按钮的渐变背景。
HTML
<button runat="server" id="btnDownload" class="button" onserverclick="clickEvent">
<i class="fa fa-download" style="font-size:20px;float:left;"></i> DOWNLOAD
</button>
按钮如下所示。
Fiddle demo here
甚至您也可以通过向<i>...</i> 添加颜色来更改图标颜色。如下所示。
<button runat="server" id="btnDownload" class="button" onserverclick="clickEvent">
<i class="fa fa-download" style="font-size:20px;float:left;color:#ff4444;"></i>
DOWNLOAD
</button>