Exercise 8 - Icon Fonts
Exercise 8 - Icon Fonts
Exercise 8 - Icon Fonts
Use icons within your website to represent various entities making use of the
glyphicons, font-awesome icons and bootstrap-social icons
Note: Some people have pointed out that if they have AdBlocker installed, then the
font icons are not showing up in their browser.
One of the most popular icon font toolkit is Font Awesome. Go to its website
http://fontawesome.io/ to check out more details about this icon font. You can
get Font Awesome using npm by typing the following at the prompt:
Another module that we install is Bootstrap Social that enables the addition of
Social buttons to our site. You can find more information about it at
https://lipis.github.io/bootstrap-social/. To install it using npm, type the following
at the prompt:
We now need to include the CSS files for font awesome and bootstrap-social in
the index.html file. Add the following code to the head of the file after the links
for importing Bootstrap CSS classes. Do the same change to aboutus.html file:
1
<link rel="stylesheet" href="node_modules/bootstrap-social/bootstrap-
social.css">
Let us now use some font icons in our web page and decorate it. Update the
navbar's ul list items as follows in index.html:
Next, in both index.html and aboutus.html, go down to the address in the footer
of the page and replace the "Tel.", "Fax" and "Email" with the corresponding
font awesome based icons as follows:
2
<i class="fa fa-envelope fa-lg"></i>:
<a href="mailto:confusion@food.net">confusion@food.net</a>
Finally, let us use the bootstrap-social CSS classes to create the social buttons
in the footer in both index.html and aboutus.html, by replacing the social sites'
links with the following code:
<div class="text-center">
<a class="btn btn-social-icon btn-google" href="http://google.com/+"><i
class="fa fa-google-plus"></i></a>
<a class="btn btn-social-icon btn-facebook"
href="http://www.facebook.com/profile.php?id="><i class="fa fa-
facebook"></i></a>
<a class="btn btn-social-icon btn-linkedin"
href="http://www.linkedin.com/in/"><i class="fa fa-linkedin"></i></a>
<a class="btn btn-social-icon btn-twitter" href="http://twitter.com/"><i
class="fa fa-twitter"></i></a>
<a class="btn btn-social-icon btn-google" href="http://youtube.com/"><i
class="fa fa-youtube"></i></a>
<a class="btn btn-social-icon" href="mailto:"><i class="fa fa-envelope-
o"></i></a>
</div>
Save all the changes and commit to your Git repository with the message "Icon
Fonts".
Conclusions
We learnt about using icon fonts in a web project.