Html Bootstrap Glyphicon 作为按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24601104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap Glyphicon as button
提问by Kye R
Say I wanted to use a glyphicon as a submit button for a form. 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.
详细地说,我不想要传统按钮的“可见”元素。只是一个字形,因为它通常会出现在文本中。
I have tried using <button>
and <input type='button'>
with the glyphicon classes, and (as one would expect), no luck.
我曾尝试使用<button>
和<input type='button'>
与字形类一起使用,并且(正如人们所期望的那样),没有运气。
回答by koala_dev
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
看到这个演示小提琴
回答by Luke
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-search"></span>
</button>