JavaScript JavaScript and the DOM Traversing the DOM Getting the First and Last Child

professionalb
professionalb
Full Stack JavaScript Techdegree Student 5,082 Points

Why are we not using icons instead of words for the buttons...

I know this isn't the point of this exercise, but at some point, are we going to learn how to use icons (maybe from Font Awesome) instead of words for our buttons?

The problem with words is they need to be localized. This is partially why all of Ikea's instructions for their furniture are displayed in pictures, not words.

1 Answer

Steven Parker
Steven Parker
201,999 Points

Using Font Awesome for button icons is relatively easy, just load it from any reliable CDN in your <head> section:

<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/font-awesome/5.10.2/css/font-awesome.min.css">

And then include the icon elements in your buttons, with or without text labels.

<button><i class="fab fa-facebook-square"></i></button> <!-- just buttons ("Ikea style") -->
<button><i class="fab fa-whatsapp"></i></button>
<button><i class="fab fa-tumblr-square"></i></button>
<button><i class="fab fa-instagram"></i></button>
<button><i class="fab fa-twitter"></i></button>
<button><i class="fab fa-weixin"></i></button>
<button><i class="fab fa-skype"></i> Skype</button>     <!-- with text also -->

Finally, style as you like in CSS:

button {
  font-size: 32px;
  min-width: 50px;
}
.fab {
  color: firebrick;
}