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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:12:07  来源:igfitidea点击:

Bootstrap Glyphicon as button

htmlcsstwitter-bootstrap

提问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-linkclass 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>

Give this a read

给这个读一读