Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Glyphicon as button

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.

like image 499
Kye Russell Avatar asked Jul 06 '14 22:07

Kye Russell


People also ask

How do I use Glyphicon icons in bootstrap 5?

In lines 15 and 17 the <span> and <a> element has the bootstrap glyphicon glyphicon-pencil classes, so to use any glyphicon in bootstrap: Use the <span> or <a> element. Set the class attribute of the <span> or <a> element as glyphicon then a space and then glyphicon-iconname.


1 Answers

You can use the .btn-link class to have a button appear as a text link:

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

See this demo fiddle

like image 108
omma2289 Avatar answered Sep 24 '22 18:09

omma2289