简体   繁体   English

Bootstrap Glyphicon作为按钮

[英]Bootstrap Glyphicon as button

Say I wanted to use a glyphicon as a submit button for a form. 假设我想使用glyphicon作为表单的提交按钮。 How would I go about doing this? 我该怎么做呢?

To elaborate, I want no 'visible' elements of a traditional button. 详细说明,我不希望传统按钮的“可见”元素。 Just a glyphicon, as it would appear normally in text. 只是一个glyphicon,因为它通常会出现在文本中。

I have tried using <button> and <input type='button'> with the glyphicon classes, and (as one would expect), no luck. 我尝试使用<button><input type='button'>和glyphicon类,并且(正如人们所期望的那样),没有运气。

You can use the .btn-link class to have a button appear as a text link: 您可以使用.btn-link类将按钮显示为文本链接:

<form>
...
<button type="submit" class="btn btn-link">
    <span class="glyphicon glyphicon-star"></span>
</button>
</form>

See this demo fiddle 看这个演示小提琴

<button type="button" class="btn btn-default">
    <span class="glyphicon glyphicon-search"></span>
</button>

Give this a read 给这个读一读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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