"Using Font Awesome Icons without JS"
Bootstrap 3.1.0 Snippet by mrmccormack

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!-- SUBMITTED: Marach 29, 2014 12:45pm --> <!-- Paste the following code into the <head> section of your site's HTML. <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> For example on Bootsnipp.com, we will place it here (despite generating a W3C validation error. --> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <div class="container"> <div class="row"> <div class="col-md-12"> <h1><i class="fa fa-flag"></i> Using Font Awesome Icons <small>without JS</small></h1> <p><span class="lead">The iconic font designed for Bootstrap</span></p> <p> <a href="http://fortawesome.github.io/Font-Awesome/examples/" target="_blank">Font Awesome on Github</a>     <a href="http://css-tricks.com/examples/IconFont/" target="_blank">CSS Tricks for Font Awesome</a>     <a href="http://fontawesome.io/icons/" target="_blank">All icons</a> </p> </div> <!-- /.col-md-12 --> </div> <!-- /.row --> <!-- Example row of columns --> <div class="row"> <div class="col-md-4"> <h2>Icon sizes</h2> <hr> <p><i class="fa fa-camera-retro fa-lg"></i> fa-camera-retro</p> <!-- NOTE: 'fa' is Font Awesom, but 'text-danger' is a Bootstrap 3 class --> <p><i class="fa fa-camera-retro fa-2x text-danger"></i> fa-camera-retro</p> <p><i class="fa fa-camera-retro fa-3x text-success"></i> fa-camera-retro</p> <p><i class="fa fa-camera-retro fa-4x text-primary"></i> fa-camera-retro</p> <p><i class="fa fa-camera-retro fa-5x text-muted"></i> fa-camera-retro</p> </div> <!-- /.col-md-4 --> <div class="col-md-4"> <h2>Spinning icons</h2> <hr> <p><i class="fa fa-spinner fa-spin fa-5x"></i></p> <p><i class="fa fa-refresh fa-spin fa-3x text-info"></i></p> <p><i class="fa fa-cog fa-spin fa-2x text-danger"></i></p> <p class="alert alert-success"><i class="fa fa-info-circle"></i> CSS3 animations aren't supported in IE8 - IE9.</p> </div> <!-- /.col-md-4 --> <div class="col-md-4"> <h2>Menus and stars</h2> <hr> <p>Star Ratings (inspired by <a href="http://css-tricks.com/star-ratings/" target="_blank">CSS Tricks</a>)</p> <div class="well"> <span class="rating"> <span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span> </span> </div> <hr> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#"><i class="fa fa-home fa-fw"></i> Home</a></li> <li><a href="#"><i class="fa fa-book fa-fw"></i> Library</a></li> <li><a href="#"><i class="fa fa-pencil fa-fw"></i> Applications</a></li> <li><a href="#"><i class="fa fa-cogs fa-fw"></i> Settings</a></li> </ul> </div> <!-- /.col-md-4 --> </div> <!-- /.row --> <hr> <p> <a href="http://validator.w3.org/check?uri=http%3a%2f%2fbootsnipp.com%2fiframe%2fVGBN;ss=1" target="_blank"><span class="glyphicon glyphicon-check" style="color: #339900;"></span><small> HTML</small><sup>5</sup></a> </p> </div> <!-- /.container -->
/* Ref: (bottom of page) http://fortawesome.github.io/Font-Awesome/examples/ */ .rating{unicode-bidi:bidi-override;direction:rtl;font-size:30px}.rating span.star{font-family:FontAwesome;font-weight:normal;font-style:normal;display:inline-block}.rating span.star:hover{cursor:pointer} .rating span.star:before{content:"\f006";padding-right:5px;color:#999} .rating span.star:hover:before,.rating span.star:hover~span.star:before{content:"\f005";color:#e3cf7a}

Related: See More


Questions / Comments:

It was absolutely unnecessary to copy & paste stuff from the font awesome web page. Their explanation of the usage is perfectly understandable and extremely easy.

n0de () - 9 years ago - Reply 0